use ::libc;
extern "C" {
    pub type event_base;
    pub type evbuffer;
    pub type bufferevent_ops;
    pub type args;
    pub type tmuxpeer;
    pub type hyperlinks;
    pub type screen_write_cline;
    pub type screen_sel;
    pub type screen_titles;
    pub type environ;
    pub type options;
    pub type format_tree;
    pub type input_ctx;
    pub type cmds;
    pub type tty_key;
    pub type tty_code;
    pub type format_job_tree;
    pub type control_state;
    pub type cmdq_list;
    pub type cmdq_item;
    pub type cmdq_state;
    pub type tmuxproc;
    fn free(_: *mut libc::c_void);
    fn memcpy(_: *mut libc::c_void, _: *const libc::c_void, _: libc::c_ulong) -> *mut libc::c_void;
    fn strcmp(_: *const libc::c_char, _: *const libc::c_char) -> libc::c_int;
    fn strlen(_: *const libc::c_char) -> libc::c_ulong;
    fn strchr(_: *const libc::c_char, _: libc::c_int) -> *mut libc::c_char;
    fn strsep(__stringp: *mut *mut libc::c_char, __delim: *const libc::c_char)
        -> *mut libc::c_char;
    fn access(__name: *const libc::c_char, __type: libc::c_int) -> libc::c_int;
    fn close(__fd: libc::c_int) -> libc::c_int;
    fn ttyname(__fd: libc::c_int) -> *mut libc::c_char;
    fn isatty(__fd: libc::c_int) -> libc::c_int;
    fn format_expand_time(_: *mut format_tree, _: *const libc::c_char) -> *mut libc::c_char;
    fn sscanf(_: *const libc::c_char, _: *const libc::c_char, _: ...) -> libc::c_int;
    fn event_add(ev: *mut event, timeout: *const timeval) -> libc::c_int;
    fn event_del(_: *mut event) -> libc::c_int;
    fn event_pending(ev: *const event, events: libc::c_short, tv: *mut timeval) -> libc::c_int;
    fn event_initialized(ev: *const event) -> libc::c_int;
    fn event_once(
        _: libc::c_int,
        _: libc::c_short,
        _: Option<unsafe extern "C" fn(libc::c_int, libc::c_short, *mut libc::c_void) -> ()>,
        _: *mut libc::c_void,
        _: *const timeval,
    ) -> libc::c_int;
    fn event_set(
        _: *mut event,
        _: libc::c_int,
        _: libc::c_short,
        _: Option<unsafe extern "C" fn(libc::c_int, libc::c_short, *mut libc::c_void) -> ()>,
        _: *mut libc::c_void,
    );
    fn evbuffer_get_length(buf: *const evbuffer) -> size_t;
    fn evbuffer_add(buf: *mut evbuffer, data: *const libc::c_void, datlen: size_t) -> libc::c_int;
    fn evbuffer_readln(
        buffer: *mut evbuffer,
        n_read_out: *mut size_t,
        eol_style: evbuffer_eol_style,
    ) -> *mut libc::c_char;
    fn evbuffer_drain(buf: *mut evbuffer, len: size_t) -> libc::c_int;
    fn evbuffer_pullup(buf: *mut evbuffer, size: ssize_t) -> *mut libc::c_uchar;
    fn bufferevent_enable(bufev: *mut bufferevent, event: libc::c_short) -> libc::c_int;
    fn bufferevent_disable(bufev: *mut bufferevent, event: libc::c_short) -> libc::c_int;
    fn imsg_get_fd(_: *mut imsg) -> libc::c_int;
    fn strlcat(_: *mut libc::c_char, _: *const libc::c_char, _: size_t) -> size_t;
    fn xmalloc(_: size_t) -> *mut libc::c_void;
    fn xcalloc(_: size_t, _: size_t) -> *mut libc::c_void;
    fn xreallocarray(_: *mut libc::c_void, _: size_t, _: size_t) -> *mut libc::c_void;
    fn xstrdup(_: *const libc::c_char) -> *mut libc::c_char;
    fn xasprintf(_: *mut *mut libc::c_char, _: *const libc::c_char, _: ...) -> libc::c_int;
    fn xsnprintf(_: *mut libc::c_char, _: size_t, _: *const libc::c_char, _: ...) -> libc::c_int;
    static mut global_options: *mut options;
    static mut global_s_options: *mut options;
    fn checkshell(_: *const libc::c_char) -> libc::c_int;
    fn setblocking(_: libc::c_int, _: libc::c_int);
    fn find_home() -> *const libc::c_char;
    fn proc_send(
        _: *mut tmuxpeer,
        _: msgtype,
        _: libc::c_int,
        _: *const libc::c_void,
        _: size_t,
    ) -> libc::c_int;
    fn proc_add_peer(
        _: *mut tmuxproc,
        _: libc::c_int,
        _: Option<unsafe extern "C" fn(*mut imsg, *mut libc::c_void) -> ()>,
        _: *mut libc::c_void,
    ) -> *mut tmuxpeer;
    fn proc_remove_peer(_: *mut tmuxpeer);
    fn proc_kill_peer(_: *mut tmuxpeer);
    static mut cfg_finished: libc::c_int;
    static mut cfg_client: *mut client;
    fn start_cfg();
    fn format_create(
        _: *mut client,
        _: *mut cmdq_item,
        _: libc::c_int,
        _: libc::c_int,
    ) -> *mut format_tree;
    fn format_free(_: *mut format_tree);
    fn gettimeofday(__tv: *mut timeval, __tz: *mut libc::c_void) -> libc::c_int;
    fn tty_send_requests(_: *mut tty);
    fn tty_repeat_requests(_: *mut tty);
    fn tty_stop_tty(_: *mut tty);
    fn tty_set_title(_: *mut tty, _: *const libc::c_char);
    fn tty_set_path(_: *mut tty, _: *const libc::c_char);
    fn tty_update_mode(_: *mut tty, _: libc::c_int, _: *mut screen);
    fn tty_sync_end(_: *mut tty);
    fn tty_open(_: *mut tty, _: *mut *mut libc::c_char) -> libc::c_int;
    fn tty_close(_: *mut tty);
    fn tty_free(_: *mut tty);
    fn tty_term_free_list(_: *mut *mut libc::c_char, _: u_int);
    fn tty_get_features(_: libc::c_int) -> *const libc::c_char;
    fn args_from_vector(_: libc::c_int, _: *mut *mut libc::c_char) -> *mut args_value;
    fn args_free_values(_: *mut args_value, _: u_int);
    fn cmd_find_from_client(_: *mut cmd_find_state, _: *mut client, _: libc::c_int) -> libc::c_int;
    fn cmd_find_from_mouse(
        _: *mut cmd_find_state,
        _: *mut mouse_event,
        _: libc::c_int,
    ) -> libc::c_int;
    fn cmd_unpack_argv(
        _: *mut libc::c_char,
        _: size_t,
        _: libc::c_int,
        _: *mut *mut *mut libc::c_char,
    ) -> libc::c_int;
    fn cmd_free_argv(_: libc::c_int, _: *mut *mut libc::c_char);
    fn cmd_list_free(_: *mut cmd_list);
    fn cmd_list_all_have(_: *mut cmd_list, _: libc::c_int) -> libc::c_int;
    fn cmd_parse_from_arguments(
        _: *mut args_value,
        _: u_int,
        _: *mut cmd_parse_input,
    ) -> *mut cmd_parse_result;
    fn cmdq_new() -> *mut cmdq_list;
    fn cmdq_free(_: *mut cmdq_list);
    fn cmdq_get_client(_: *mut cmdq_item) -> *mut client;
    fn cmdq_get_command(_: *mut cmd_list, _: *mut cmdq_state) -> *mut cmdq_item;
    fn cmdq_get_callback1(
        _: *const libc::c_char,
        _: cmdq_cb,
        _: *mut libc::c_void,
    ) -> *mut cmdq_item;
    fn cmdq_get_error(_: *const libc::c_char) -> *mut cmdq_item;
    fn cmdq_append(_: *mut client, _: *mut cmdq_item) -> *mut cmdq_item;
    fn cmdq_error(_: *mut cmdq_item, _: *const libc::c_char, _: ...);
    fn key_bindings_get_table(_: *const libc::c_char, _: libc::c_int) -> *mut key_table;
    fn key_bindings_unref_table(_: *mut key_table);
    fn key_bindings_get(_: *mut key_table, _: key_code) -> *mut key_binding;
    fn key_bindings_dispatch(
        _: *mut key_binding,
        _: *mut cmdq_item,
        _: *mut client,
        _: *mut key_event,
        _: *mut cmd_find_state,
    ) -> *mut cmdq_item;
    fn key_string_lookup_key(_: key_code, _: libc::c_int) -> *const libc::c_char;
    fn alerts_check_session(_: *mut session);
    fn client_files_RB_NEXT(_: *mut client_file) -> *mut client_file;
    fn client_files_RB_MINMAX(_: *mut client_files, _: libc::c_int) -> *mut client_file;
    fn file_fire_done(_: *mut client_file);
    fn file_print(_: *mut client, _: *const libc::c_char, _: ...);
    fn file_write_ready(_: *mut client_files, _: *mut imsg);
    fn file_read_data(_: *mut client_files, _: *mut imsg);
    fn file_read_done(_: *mut client_files, _: *mut imsg);
    static mut server_proc: *mut tmuxproc;
    static mut clients: clients;
    fn server_update_socket();
    fn server_add_accept(_: libc::c_int);
    fn tty_resize(_: *mut tty);
    fn tty_init(_: *mut tty, _: *mut client) -> libc::c_int;
    fn server_redraw_client(_: *mut client);
    fn tty_cursor(_: *mut tty, _: u_int, _: u_int);
    fn tty_margin_off(_: *mut tty);
    fn tty_region_off(_: *mut tty);
    fn tty_reset(_: *mut tty);
    fn server_status_client(_: *mut client);
    fn tty_update_client_offset(_: *mut client);
    fn tty_window_offset(
        _: *mut tty,
        _: *mut u_int,
        _: *mut u_int,
        _: *mut u_int,
        _: *mut u_int,
    ) -> libc::c_int;
    fn tty_start_tty(_: *mut tty);
    fn environ_put(_: *mut environ, _: *const libc::c_char, _: libc::c_int);
    fn environ_find(_: *mut environ, _: *const libc::c_char) -> *mut environ_entry;
    fn environ_free(_: *mut environ);
    fn environ_create() -> *mut environ;
    fn status_get_range(_: *mut client, _: u_int, _: u_int) -> *mut style_range;
    fn status_line_size(_: *mut client) -> u_int;
    fn status_at_line(_: *mut client) -> libc::c_int;
    fn status_message_clear(_: *mut client);
    fn status_init(_: *mut client);
    fn server_check_unattached();
    fn status_timer_start(_: *mut client);
    fn options_get_number(_: *mut options, _: *const libc::c_char) -> libc::c_longlong;
    fn options_get_string(_: *mut options, _: *const libc::c_char) -> *const libc::c_char;
    fn status_free(_: *mut client);
    fn format_defaults(
        _: *mut format_tree,
        _: *mut client,
        _: *mut session,
        _: *mut winlink,
        _: *mut window_pane,
    );
    fn format_lost_client(_: *mut client);
    fn notify_client(_: *const libc::c_char, _: *mut client);
    fn screen_mode_to_string(_: libc::c_int) -> *const libc::c_char;
    fn window_update_focus(_: *mut window);
    fn window_pane_tree_RB_NEXT(_: *mut window_pane) -> *mut window_pane;
    static mut all_window_panes: window_pane_tree;
    fn window_pane_tree_RB_MINMAX(_: *mut window_pane_tree, _: libc::c_int) -> *mut window_pane;
    fn recalculate_size(_: *mut window, _: libc::c_int);
    fn screen_redraw_screen(_: *mut client);
    fn screen_redraw_pane(_: *mut client, _: *mut window_pane, _: libc::c_int);
    fn resize_window(_: *mut window, _: u_int, _: u_int, _: libc::c_int, _: libc::c_int);
    fn status_prompt_clear(_: *mut client);
    fn windows_RB_MINMAX(_: *mut windows, _: libc::c_int) -> *mut window;
    static mut windows: windows;
    fn windows_RB_NEXT(_: *mut window) -> *mut window;
    fn recalculate_sizes();
    fn status_prompt_key(_: *mut client, _: key_code) -> libc::c_int;
    fn winlink_find_by_index(_: *mut winlinks, _: libc::c_int) -> *mut winlink;
    fn window_get_active_at(_: *mut window, _: u_int, _: u_int) -> *mut window_pane;
    fn window_pane_send_resize(_: *mut window_pane, _: u_int, _: u_int);
    fn window_pane_show_scrollbar(_: *mut window_pane, _: libc::c_int) -> libc::c_int;
    fn window_pane_paste(_: *mut window_pane, _: *mut libc::c_char, _: size_t);
    fn window_pane_find_by_id(_: u_int) -> *mut window_pane;
    fn window_pane_key(
        _: *mut window_pane,
        _: *mut client,
        _: *mut session,
        _: *mut winlink,
        _: key_code,
        _: *mut mouse_event,
    ) -> libc::c_int;
    fn control_ready(_: *mut client);
    fn control_start(_: *mut client);
    fn control_stop(_: *mut client);
    fn control_write(_: *mut client, _: *const libc::c_char, _: ...);
    fn window_pane_set_mode(
        _: *mut window_pane,
        _: *mut window_pane,
        _: *const window_mode,
        _: *mut cmd_find_state,
        _: *mut args,
    ) -> libc::c_int;
    static window_view_mode: window_mode;
    fn window_copy_add(_: *mut window_pane, _: libc::c_int, _: *const libc::c_char, _: ...);
    fn control_reset_offsets(_: *mut client);
    fn check_window_name(_: *mut window);
    fn control_discard(_: *mut client);
    fn control_all_done(_: *mut client) -> libc::c_int;
    fn control_pane_offset(
        _: *mut client,
        _: *mut window_pane,
        _: *mut libc::c_int,
    ) -> *mut window_pane_offset;
    fn window_pane_get_new_data(
        _: *mut window_pane,
        _: *mut window_pane_offset,
        _: *mut size_t,
    ) -> *mut libc::c_void;
    fn session_find_by_id(_: u_int) -> *mut session;
    fn session_update_activity(_: *mut session, _: *mut timeval);
    fn utf8_sanitize(_: *const libc::c_char) -> *mut libc::c_char;
    fn utf8_stravisx(
        _: *mut *mut libc::c_char,
        _: *const libc::c_char,
        _: size_t,
        _: libc::c_int,
    ) -> libc::c_int;
    fn fatal(_: *const libc::c_char, _: ...) -> !;
    fn log_get_level() -> libc::c_int;
    fn log_debug(_: *const libc::c_char, _: ...);
    fn fatalx(_: *const libc::c_char, _: ...) -> !;
}
pub type __u_char = libc::c_uchar;
pub type __u_short = libc::c_ushort;
pub type __u_int = libc::c_uint;
pub type __uint8_t = libc::c_uchar;
pub type __uint16_t = libc::c_ushort;
pub type __uint32_t = libc::c_uint;
pub type __uint64_t = libc::c_ulong;
pub type __pid_t = libc::c_int;
pub type __time_t = libc::c_long;
pub type __suseconds_t = libc::c_long;
pub type __ssize_t = libc::c_long;
pub type u_char = __u_char;
pub type u_short = __u_short;
pub type u_int = __u_int;
pub type pid_t = __pid_t;
pub type ssize_t = __ssize_t;
pub type time_t = __time_t;
pub type size_t = libc::c_ulong;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct timeval {
    pub tv_sec: __time_t,
    pub tv_usec: __suseconds_t,
}
pub type cc_t = libc::c_uchar;
pub type speed_t = libc::c_uint;
pub type tcflag_t = libc::c_uint;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct termios {
    pub c_iflag: tcflag_t,
    pub c_oflag: tcflag_t,
    pub c_cflag: tcflag_t,
    pub c_lflag: tcflag_t,
    pub c_line: cc_t,
    pub c_cc: [cc_t; 32],
    pub c_ispeed: speed_t,
    pub c_ospeed: speed_t,
}
pub type uint8_t = __uint8_t;
pub type uint16_t = __uint16_t;
pub type uint32_t = __uint32_t;
pub type uint64_t = __uint64_t;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct event {
    pub ev_evcallback: event_callback,
    pub ev_timeout_pos: C2RustUnnamed_4,
    pub ev_fd: libc::c_int,
    pub ev_base: *mut event_base,
    pub ev_: C2RustUnnamed,
    pub ev_events: libc::c_short,
    pub ev_res: libc::c_short,
    pub ev_timeout: timeval,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union C2RustUnnamed {
    pub ev_io: C2RustUnnamed_2,
    pub ev_signal: C2RustUnnamed_0,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_0 {
    pub ev_signal_next: C2RustUnnamed_1,
    pub ev_ncalls: libc::c_short,
    pub ev_pncalls: *mut libc::c_short,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_1 {
    pub le_next: *mut event,
    pub le_prev: *mut *mut event,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_2 {
    pub ev_io_next: C2RustUnnamed_3,
    pub ev_timeout: timeval,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_3 {
    pub le_next: *mut event,
    pub le_prev: *mut *mut event,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union C2RustUnnamed_4 {
    pub ev_next_with_common_timeout: C2RustUnnamed_5,
    pub min_heap_idx: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_5 {
    pub tqe_next: *mut event,
    pub tqe_prev: *mut *mut event,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct event_callback {
    pub evcb_active_next: C2RustUnnamed_7,
    pub evcb_flags: libc::c_short,
    pub evcb_pri: uint8_t,
    pub evcb_closure: uint8_t,
    pub evcb_cb_union: C2RustUnnamed_6,
    pub evcb_arg: *mut libc::c_void,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union C2RustUnnamed_6 {
    pub evcb_callback:
        Option<unsafe extern "C" fn(libc::c_int, libc::c_short, *mut libc::c_void) -> ()>,
    pub evcb_selfcb: Option<unsafe extern "C" fn(*mut event_callback, *mut libc::c_void) -> ()>,
    pub evcb_evfinalize: Option<unsafe extern "C" fn(*mut event, *mut libc::c_void) -> ()>,
    pub evcb_cbfinalize: Option<unsafe extern "C" fn(*mut event_callback, *mut libc::c_void) -> ()>,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_7 {
    pub tqe_next: *mut event_callback,
    pub tqe_prev: *mut *mut event_callback,
}
pub type evbuffer_eol_style = libc::c_uint;
pub const EVBUFFER_EOL_NUL: evbuffer_eol_style = 4;
pub const EVBUFFER_EOL_LF: evbuffer_eol_style = 3;
pub const EVBUFFER_EOL_CRLF_STRICT: evbuffer_eol_style = 2;
pub const EVBUFFER_EOL_CRLF: evbuffer_eol_style = 1;
pub const EVBUFFER_EOL_ANY: evbuffer_eol_style = 0;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct bufferevent {
    pub ev_base: *mut event_base,
    pub be_ops: *const bufferevent_ops,
    pub ev_read: event,
    pub ev_write: event,
    pub input: *mut evbuffer,
    pub output: *mut evbuffer,
    pub wm_read: event_watermark,
    pub wm_write: event_watermark,
    pub readcb: bufferevent_data_cb,
    pub writecb: bufferevent_data_cb,
    pub errorcb: bufferevent_event_cb,
    pub cbarg: *mut libc::c_void,
    pub timeout_read: timeval,
    pub timeout_write: timeval,
    pub enabled: libc::c_short,
}
pub type bufferevent_event_cb =
    Option<unsafe extern "C" fn(*mut bufferevent, libc::c_short, *mut libc::c_void) -> ()>;
pub type bufferevent_data_cb =
    Option<unsafe extern "C" fn(*mut bufferevent, *mut libc::c_void) -> ()>;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct event_watermark {
    pub low: size_t,
    pub high: size_t,
}
pub type bitstr_t = libc::c_uchar;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct ibuf {
    pub entry: C2RustUnnamed_8,
    pub buf: *mut libc::c_uchar,
    pub size: size_t,
    pub max: size_t,
    pub wpos: size_t,
    pub rpos: size_t,
    pub fd: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_8 {
    pub tqe_next: *mut ibuf,
    pub tqe_prev: *mut *mut ibuf,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct imsg_hdr {
    pub type_0: uint32_t,
    pub len: uint16_t,
    pub flags: uint16_t,
    pub peerid: uint32_t,
    pub pid: uint32_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct imsg {
    pub hdr: imsg_hdr,
    pub fd: libc::c_int,
    pub data: *mut libc::c_void,
    pub buf: *mut ibuf,
}
pub type msgtype = libc::c_uint;
pub const MSG_READ_CANCEL: msgtype = 307;
pub const MSG_WRITE_CLOSE: msgtype = 306;
pub const MSG_WRITE_READY: msgtype = 305;
pub const MSG_WRITE: msgtype = 304;
pub const MSG_WRITE_OPEN: msgtype = 303;
pub const MSG_READ_DONE: msgtype = 302;
pub const MSG_READ: msgtype = 301;
pub const MSG_READ_OPEN: msgtype = 300;
pub const MSG_FLAGS: msgtype = 218;
pub const MSG_EXEC: msgtype = 217;
pub const MSG_WAKEUP: msgtype = 216;
pub const MSG_UNLOCK: msgtype = 215;
pub const MSG_SUSPEND: msgtype = 214;
pub const MSG_OLDSTDOUT: msgtype = 213;
pub const MSG_OLDSTDIN: msgtype = 212;
pub const MSG_OLDSTDERR: msgtype = 211;
pub const MSG_SHUTDOWN: msgtype = 210;
pub const MSG_SHELL: msgtype = 209;
pub const MSG_RESIZE: msgtype = 208;
pub const MSG_READY: msgtype = 207;
pub const MSG_LOCK: msgtype = 206;
pub const MSG_EXITING: msgtype = 205;
pub const MSG_EXITED: msgtype = 204;
pub const MSG_EXIT: msgtype = 203;
pub const MSG_DETACHKILL: msgtype = 202;
pub const MSG_DETACH: msgtype = 201;
pub const MSG_COMMAND: msgtype = 200;
pub const MSG_IDENTIFY_TERMINFO: msgtype = 112;
pub const MSG_IDENTIFY_LONGFLAGS: msgtype = 111;
pub const MSG_IDENTIFY_STDOUT: msgtype = 110;
pub const MSG_IDENTIFY_FEATURES: msgtype = 109;
pub const MSG_IDENTIFY_CWD: msgtype = 108;
pub const MSG_IDENTIFY_CLIENTPID: msgtype = 107;
pub const MSG_IDENTIFY_DONE: msgtype = 106;
pub const MSG_IDENTIFY_ENVIRON: msgtype = 105;
pub const MSG_IDENTIFY_STDIN: msgtype = 104;
pub const MSG_IDENTIFY_OLDCWD: msgtype = 103;
pub const MSG_IDENTIFY_TTYNAME: msgtype = 102;
pub const MSG_IDENTIFY_TERM: msgtype = 101;
pub const MSG_IDENTIFY_FLAGS: msgtype = 100;
pub const MSG_VERSION: msgtype = 12;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct msg_command {
    pub argc: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct client {
    pub name: *const libc::c_char,
    pub peer: *mut tmuxpeer,
    pub queue: *mut cmdq_list,
    pub windows: client_windows,
    pub control_state: *mut control_state,
    pub pause_age: u_int,
    pub pid: pid_t,
    pub fd: libc::c_int,
    pub out_fd: libc::c_int,
    pub event: event,
    pub retval: libc::c_int,
    pub creation_time: timeval,
    pub activity_time: timeval,
    pub last_activity_time: timeval,
    pub environ: *mut environ,
    pub jobs: *mut format_job_tree,
    pub title: *mut libc::c_char,
    pub path: *mut libc::c_char,
    pub cwd: *const libc::c_char,
    pub term_name: *mut libc::c_char,
    pub term_features: libc::c_int,
    pub term_type: *mut libc::c_char,
    pub term_caps: *mut *mut libc::c_char,
    pub term_ncaps: u_int,
    pub ttyname: *mut libc::c_char,
    pub tty: tty,
    pub written: size_t,
    pub discarded: size_t,
    pub redraw: size_t,
    pub repeat_timer: event,
    pub click_timer: event,
    pub click_button: u_int,
    pub click_event: mouse_event,
    pub status: status_line,
    pub flags: uint64_t,
    pub exit_type: C2RustUnnamed_31,
    pub exit_msgtype: msgtype,
    pub exit_session: *mut libc::c_char,
    pub exit_message: *mut libc::c_char,
    pub keytable: *mut key_table,
    pub last_key: key_code,
    pub redraw_panes: uint64_t,
    pub redraw_scrollbars: uint64_t,
    pub message_ignore_keys: libc::c_int,
    pub message_ignore_styles: libc::c_int,
    pub message_string: *mut libc::c_char,
    pub message_timer: event,
    pub prompt_string: *mut libc::c_char,
    pub prompt_buffer: *mut utf8_data,
    pub prompt_last: *mut libc::c_char,
    pub prompt_index: size_t,
    pub prompt_inputcb: prompt_input_cb,
    pub prompt_freecb: prompt_free_cb,
    pub prompt_data: *mut libc::c_void,
    pub prompt_hindex: [u_int; 4],
    pub prompt_mode: C2RustUnnamed_28,
    pub prompt_saved: *mut utf8_data,
    pub prompt_flags: libc::c_int,
    pub prompt_type: prompt_type,
    pub prompt_cursor: libc::c_int,
    pub session: *mut session,
    pub last_session: *mut session,
    pub references: libc::c_int,
    pub pan_window: *mut libc::c_void,
    pub pan_ox: u_int,
    pub pan_oy: u_int,
    pub overlay_check: overlay_check_cb,
    pub overlay_mode: overlay_mode_cb,
    pub overlay_draw: overlay_draw_cb,
    pub overlay_key: overlay_key_cb,
    pub overlay_free: overlay_free_cb,
    pub overlay_resize: overlay_resize_cb,
    pub overlay_data: *mut libc::c_void,
    pub overlay_timer: event,
    pub files: client_files,
    pub clipboard_panes: *mut u_int,
    pub clipboard_npanes: u_int,
    pub entry: C2RustUnnamed_9,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_9 {
    pub tqe_next: *mut client,
    pub tqe_prev: *mut *mut client,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct client_files {
    pub rbh_root: *mut client_file,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct client_file {
    pub c: *mut client,
    pub peer: *mut tmuxpeer,
    pub tree: *mut client_files,
    pub references: libc::c_int,
    pub stream: libc::c_int,
    pub path: *mut libc::c_char,
    pub buffer: *mut evbuffer,
    pub event: *mut bufferevent,
    pub fd: libc::c_int,
    pub error: libc::c_int,
    pub closed: libc::c_int,
    pub cb: client_file_cb,
    pub data: *mut libc::c_void,
    pub entry: C2RustUnnamed_10,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_10 {
    pub rbe_left: *mut client_file,
    pub rbe_right: *mut client_file,
    pub rbe_parent: *mut client_file,
    pub rbe_color: libc::c_int,
}
pub type client_file_cb = Option<
    unsafe extern "C" fn(
        *mut client,
        *const libc::c_char,
        libc::c_int,
        libc::c_int,
        *mut evbuffer,
        *mut libc::c_void,
    ) -> (),
>;
pub type overlay_resize_cb = Option<unsafe extern "C" fn(*mut client, *mut libc::c_void) -> ()>;
pub type overlay_free_cb = Option<unsafe extern "C" fn(*mut client, *mut libc::c_void) -> ()>;
pub type overlay_key_cb =
    Option<unsafe extern "C" fn(*mut client, *mut libc::c_void, *mut key_event) -> libc::c_int>;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct key_event {
    pub key: key_code,
    pub m: mouse_event,
    pub buf: *mut libc::c_char,
    pub len: size_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct mouse_event {
    pub valid: libc::c_int,
    pub ignore: libc::c_int,
    pub key: key_code,
    pub statusat: libc::c_int,
    pub statuslines: u_int,
    pub x: u_int,
    pub y: u_int,
    pub b: u_int,
    pub lx: u_int,
    pub ly: u_int,
    pub lb: u_int,
    pub ox: u_int,
    pub oy: u_int,
    pub s: libc::c_int,
    pub w: libc::c_int,
    pub wp: libc::c_int,
    pub sgr_type: u_int,
    pub sgr_b: u_int,
}
pub type key_code = libc::c_ulonglong;
pub type overlay_draw_cb =
    Option<unsafe extern "C" fn(*mut client, *mut libc::c_void, *mut screen_redraw_ctx) -> ()>;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct screen_redraw_ctx {
    pub c: *mut client,
    pub statuslines: u_int,
    pub statustop: libc::c_int,
    pub pane_status: libc::c_int,
    pub pane_lines: pane_lines,
    pub pane_scrollbars: libc::c_int,
    pub pane_scrollbars_pos: libc::c_int,
    pub no_pane_gc: grid_cell,
    pub no_pane_gc_set: libc::c_int,
    pub sx: u_int,
    pub sy: u_int,
    pub ox: u_int,
    pub oy: u_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct grid_cell {
    pub data: utf8_data,
    pub attr: u_short,
    pub flags: u_char,
    pub fg: libc::c_int,
    pub bg: libc::c_int,
    pub us: libc::c_int,
    pub link: u_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct utf8_data {
    pub data: [u_char; 21],
    pub have: u_char,
    pub size: u_char,
    pub width: u_char,
}
pub type pane_lines = libc::c_uint;
pub const PANE_LINES_NUMBER: pane_lines = 4;
pub const PANE_LINES_SIMPLE: pane_lines = 3;
pub const PANE_LINES_HEAVY: pane_lines = 2;
pub const PANE_LINES_DOUBLE: pane_lines = 1;
pub const PANE_LINES_SINGLE: pane_lines = 0;
pub type overlay_mode_cb = Option<
    unsafe extern "C" fn(*mut client, *mut libc::c_void, *mut u_int, *mut u_int) -> *mut screen,
>;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct screen {
    pub title: *mut libc::c_char,
    pub path: *mut libc::c_char,
    pub titles: *mut screen_titles,
    pub grid: *mut grid,
    pub cx: u_int,
    pub cy: u_int,
    pub cstyle: screen_cursor_style,
    pub default_cstyle: screen_cursor_style,
    pub ccolour: libc::c_int,
    pub default_ccolour: libc::c_int,
    pub rupper: u_int,
    pub rlower: u_int,
    pub mode: libc::c_int,
    pub default_mode: libc::c_int,
    pub saved_cx: u_int,
    pub saved_cy: u_int,
    pub saved_grid: *mut grid,
    pub saved_cell: grid_cell,
    pub saved_flags: libc::c_int,
    pub tabs: *mut bitstr_t,
    pub sel: *mut screen_sel,
    pub write_list: *mut screen_write_cline,
    pub hyperlinks: *mut hyperlinks,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct grid {
    pub flags: libc::c_int,
    pub sx: u_int,
    pub sy: u_int,
    pub hscrolled: u_int,
    pub hsize: u_int,
    pub hlimit: u_int,
    pub linedata: *mut grid_line,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct grid_line {
    pub celldata: *mut grid_cell_entry,
    pub cellused: u_int,
    pub cellsize: u_int,
    pub extddata: *mut grid_extd_entry,
    pub extdsize: u_int,
    pub flags: libc::c_int,
    pub time: time_t,
}
#[derive(Copy, Clone)]
#[repr(C, packed)]
pub struct grid_extd_entry {
    pub data: utf8_char,
    pub attr: u_short,
    pub flags: u_char,
    pub fg: libc::c_int,
    pub bg: libc::c_int,
    pub us: libc::c_int,
    pub link: u_int,
}
pub type utf8_char = u_int;
#[derive(Copy, Clone)]
#[repr(C, packed)]
pub struct grid_cell_entry {
    pub c2rust_unnamed: C2RustUnnamed_11,
    pub flags: u_char,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union C2RustUnnamed_11 {
    pub offset: u_int,
    pub data: C2RustUnnamed_12,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_12 {
    pub attr: u_char,
    pub fg: u_char,
    pub bg: u_char,
    pub data: u_char,
}
pub type screen_cursor_style = libc::c_uint;
pub const SCREEN_CURSOR_BAR: screen_cursor_style = 3;
pub const SCREEN_CURSOR_UNDERLINE: screen_cursor_style = 2;
pub const SCREEN_CURSOR_BLOCK: screen_cursor_style = 1;
pub const SCREEN_CURSOR_DEFAULT: screen_cursor_style = 0;
pub type overlay_check_cb = Option<
    unsafe extern "C" fn(
        *mut client,
        *mut libc::c_void,
        u_int,
        u_int,
        u_int,
        *mut overlay_ranges,
    ) -> (),
>;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct overlay_ranges {
    pub px: [u_int; 3],
    pub nx: [u_int; 3],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct session {
    pub id: u_int,
    pub name: *mut libc::c_char,
    pub cwd: *const libc::c_char,
    pub creation_time: timeval,
    pub last_attached_time: timeval,
    pub activity_time: timeval,
    pub last_activity_time: timeval,
    pub lock_timer: event,
    pub curw: *mut winlink,
    pub lastw: winlink_stack,
    pub windows: winlinks,
    pub statusat: libc::c_int,
    pub statuslines: u_int,
    pub options: *mut options,
    pub flags: libc::c_int,
    pub attached: u_int,
    pub tio: *mut termios,
    pub environ: *mut environ,
    pub references: libc::c_int,
    pub gentry: C2RustUnnamed_14,
    pub entry: C2RustUnnamed_13,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_13 {
    pub rbe_left: *mut session,
    pub rbe_right: *mut session,
    pub rbe_parent: *mut session,
    pub rbe_color: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_14 {
    pub tqe_next: *mut session,
    pub tqe_prev: *mut *mut session,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct winlinks {
    pub rbh_root: *mut winlink,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct winlink {
    pub idx: libc::c_int,
    pub session: *mut session,
    pub window: *mut window,
    pub flags: libc::c_int,
    pub entry: C2RustUnnamed_17,
    pub wentry: C2RustUnnamed_16,
    pub sentry: C2RustUnnamed_15,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_15 {
    pub tqe_next: *mut winlink,
    pub tqe_prev: *mut *mut winlink,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_16 {
    pub tqe_next: *mut winlink,
    pub tqe_prev: *mut *mut winlink,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_17 {
    pub rbe_left: *mut winlink,
    pub rbe_right: *mut winlink,
    pub rbe_parent: *mut winlink,
    pub rbe_color: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window {
    pub id: u_int,
    pub latest: *mut libc::c_void,
    pub name: *mut libc::c_char,
    pub name_event: event,
    pub name_time: timeval,
    pub alerts_timer: event,
    pub offset_timer: event,
    pub activity_time: timeval,
    pub active: *mut window_pane,
    pub last_panes: window_panes,
    pub panes: window_panes,
    pub lastlayout: libc::c_int,
    pub layout_root: *mut layout_cell,
    pub saved_layout_root: *mut layout_cell,
    pub old_layout: *mut libc::c_char,
    pub sx: u_int,
    pub sy: u_int,
    pub manual_sx: u_int,
    pub manual_sy: u_int,
    pub xpixel: u_int,
    pub ypixel: u_int,
    pub new_sx: u_int,
    pub new_sy: u_int,
    pub new_xpixel: u_int,
    pub new_ypixel: u_int,
    pub fill_character: *mut utf8_data,
    pub flags: libc::c_int,
    pub alerts_queued: libc::c_int,
    pub alerts_entry: C2RustUnnamed_20,
    pub options: *mut options,
    pub references: u_int,
    pub winlinks: C2RustUnnamed_19,
    pub entry: C2RustUnnamed_18,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_18 {
    pub rbe_left: *mut window,
    pub rbe_right: *mut window,
    pub rbe_parent: *mut window,
    pub rbe_color: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_19 {
    pub tqh_first: *mut winlink,
    pub tqh_last: *mut *mut winlink,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_20 {
    pub tqe_next: *mut window,
    pub tqe_prev: *mut *mut window,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct layout_cell {
    pub type_0: layout_type,
    pub parent: *mut layout_cell,
    pub sx: u_int,
    pub sy: u_int,
    pub xoff: u_int,
    pub yoff: u_int,
    pub wp: *mut window_pane,
    pub cells: layout_cells,
    pub entry: C2RustUnnamed_21,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_21 {
    pub tqe_next: *mut layout_cell,
    pub tqe_prev: *mut *mut layout_cell,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct layout_cells {
    pub tqh_first: *mut layout_cell,
    pub tqh_last: *mut *mut layout_cell,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_pane {
    pub id: u_int,
    pub active_point: u_int,
    pub window: *mut window,
    pub options: *mut options,
    pub layout_cell: *mut layout_cell,
    pub saved_layout_cell: *mut layout_cell,
    pub sx: u_int,
    pub sy: u_int,
    pub xoff: u_int,
    pub yoff: u_int,
    pub flags: libc::c_int,
    pub sb_slider_y: u_int,
    pub sb_slider_h: u_int,
    pub argc: libc::c_int,
    pub argv: *mut *mut libc::c_char,
    pub shell: *mut libc::c_char,
    pub cwd: *mut libc::c_char,
    pub pid: pid_t,
    pub tty: [libc::c_char; 32],
    pub status: libc::c_int,
    pub dead_time: timeval,
    pub fd: libc::c_int,
    pub event: *mut bufferevent,
    pub offset: window_pane_offset,
    pub base_offset: size_t,
    pub resize_queue: window_pane_resizes,
    pub resize_timer: event,
    pub ictx: *mut input_ctx,
    pub cached_gc: grid_cell,
    pub cached_active_gc: grid_cell,
    pub palette: colour_palette,
    pub pipe_fd: libc::c_int,
    pub pipe_event: *mut bufferevent,
    pub pipe_offset: window_pane_offset,
    pub screen: *mut screen,
    pub base: screen,
    pub status_screen: screen,
    pub status_size: size_t,
    pub modes: C2RustUnnamed_25,
    pub searchstr: *mut libc::c_char,
    pub searchregex: libc::c_int,
    pub border_gc_set: libc::c_int,
    pub border_gc: grid_cell,
    pub control_bg: libc::c_int,
    pub control_fg: libc::c_int,
    pub scrollbar_style: style,
    pub entry: C2RustUnnamed_24,
    pub sentry: C2RustUnnamed_23,
    pub tree_entry: C2RustUnnamed_22,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_22 {
    pub rbe_left: *mut window_pane,
    pub rbe_right: *mut window_pane,
    pub rbe_parent: *mut window_pane,
    pub rbe_color: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_23 {
    pub tqe_next: *mut window_pane,
    pub tqe_prev: *mut *mut window_pane,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_24 {
    pub tqe_next: *mut window_pane,
    pub tqe_prev: *mut *mut window_pane,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct style {
    pub gc: grid_cell,
    pub ignore: libc::c_int,
    pub fill: libc::c_int,
    pub align: style_align,
    pub list: style_list,
    pub range_type: style_range_type,
    pub range_argument: u_int,
    pub range_string: [libc::c_char; 16],
    pub width: libc::c_int,
    pub pad: libc::c_int,
    pub default_type: style_default_type,
}
pub type style_default_type = libc::c_uint;
pub const STYLE_DEFAULT_POP: style_default_type = 2;
pub const STYLE_DEFAULT_PUSH: style_default_type = 1;
pub const STYLE_DEFAULT_BASE: style_default_type = 0;
pub type style_range_type = libc::c_uint;
pub const STYLE_RANGE_USER: style_range_type = 6;
pub const STYLE_RANGE_SESSION: style_range_type = 5;
pub const STYLE_RANGE_WINDOW: style_range_type = 4;
pub const STYLE_RANGE_PANE: style_range_type = 3;
pub const STYLE_RANGE_RIGHT: style_range_type = 2;
pub const STYLE_RANGE_LEFT: style_range_type = 1;
pub const STYLE_RANGE_NONE: style_range_type = 0;
pub type style_list = libc::c_uint;
pub const STYLE_LIST_RIGHT_MARKER: style_list = 4;
pub const STYLE_LIST_LEFT_MARKER: style_list = 3;
pub const STYLE_LIST_FOCUS: style_list = 2;
pub const STYLE_LIST_ON: style_list = 1;
pub const STYLE_LIST_OFF: style_list = 0;
pub type style_align = libc::c_uint;
pub const STYLE_ALIGN_ABSOLUTE_CENTRE: style_align = 4;
pub const STYLE_ALIGN_RIGHT: style_align = 3;
pub const STYLE_ALIGN_CENTRE: style_align = 2;
pub const STYLE_ALIGN_LEFT: style_align = 1;
pub const STYLE_ALIGN_DEFAULT: style_align = 0;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_25 {
    pub tqh_first: *mut window_mode_entry,
    pub tqh_last: *mut *mut window_mode_entry,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_mode_entry {
    pub wp: *mut window_pane,
    pub swp: *mut window_pane,
    pub mode: *const window_mode,
    pub data: *mut libc::c_void,
    pub screen: *mut screen,
    pub prefix: u_int,
    pub entry: C2RustUnnamed_26,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_26 {
    pub tqe_next: *mut window_mode_entry,
    pub tqe_prev: *mut *mut window_mode_entry,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_mode {
    pub name: *const libc::c_char,
    pub default_format: *const libc::c_char,
    pub init: Option<
        unsafe extern "C" fn(*mut window_mode_entry, *mut cmd_find_state, *mut args) -> *mut screen,
    >,
    pub free: Option<unsafe extern "C" fn(*mut window_mode_entry) -> ()>,
    pub resize: Option<unsafe extern "C" fn(*mut window_mode_entry, u_int, u_int) -> ()>,
    pub update: Option<unsafe extern "C" fn(*mut window_mode_entry) -> ()>,
    pub key: Option<
        unsafe extern "C" fn(
            *mut window_mode_entry,
            *mut client,
            *mut session,
            *mut winlink,
            key_code,
            *mut mouse_event,
        ) -> (),
    >,
    pub key_table: Option<unsafe extern "C" fn(*mut window_mode_entry) -> *const libc::c_char>,
    pub command: Option<
        unsafe extern "C" fn(
            *mut window_mode_entry,
            *mut client,
            *mut session,
            *mut winlink,
            *mut args,
            *mut mouse_event,
        ) -> (),
    >,
    pub formats: Option<unsafe extern "C" fn(*mut window_mode_entry, *mut format_tree) -> ()>,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_find_state {
    pub flags: libc::c_int,
    pub current: *mut cmd_find_state,
    pub s: *mut session,
    pub wl: *mut winlink,
    pub w: *mut window,
    pub wp: *mut window_pane,
    pub idx: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_pane_offset {
    pub used: size_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct colour_palette {
    pub fg: libc::c_int,
    pub bg: libc::c_int,
    pub palette: *mut libc::c_int,
    pub default_palette: *mut libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_pane_resizes {
    pub tqh_first: *mut window_pane_resize,
    pub tqh_last: *mut *mut window_pane_resize,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_pane_resize {
    pub sx: u_int,
    pub sy: u_int,
    pub osx: u_int,
    pub osy: u_int,
    pub entry: C2RustUnnamed_27,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_27 {
    pub tqe_next: *mut window_pane_resize,
    pub tqe_prev: *mut *mut window_pane_resize,
}
pub type layout_type = libc::c_uint;
pub const LAYOUT_WINDOWPANE: layout_type = 2;
pub const LAYOUT_TOPBOTTOM: layout_type = 1;
pub const LAYOUT_LEFTRIGHT: layout_type = 0;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_panes {
    pub tqh_first: *mut window_pane,
    pub tqh_last: *mut *mut window_pane,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct winlink_stack {
    pub tqh_first: *mut winlink,
    pub tqh_last: *mut *mut winlink,
}
pub type prompt_type = libc::c_uint;
pub const PROMPT_TYPE_INVALID: prompt_type = 255;
pub const PROMPT_TYPE_WINDOW_TARGET: prompt_type = 3;
pub const PROMPT_TYPE_TARGET: prompt_type = 2;
pub const PROMPT_TYPE_SEARCH: prompt_type = 1;
pub const PROMPT_TYPE_COMMAND: prompt_type = 0;
pub type C2RustUnnamed_28 = libc::c_uint;
pub const PROMPT_COMMAND: C2RustUnnamed_28 = 1;
pub const PROMPT_ENTRY: C2RustUnnamed_28 = 0;
pub type prompt_free_cb = Option<unsafe extern "C" fn(*mut libc::c_void) -> ()>;
pub type prompt_input_cb = Option<
    unsafe extern "C" fn(
        *mut client,
        *mut libc::c_void,
        *const libc::c_char,
        libc::c_int,
    ) -> libc::c_int,
>;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct key_table {
    pub name: *const libc::c_char,
    pub activity_time: timeval,
    pub key_bindings: key_bindings,
    pub default_key_bindings: key_bindings,
    pub references: u_int,
    pub entry: C2RustUnnamed_29,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_29 {
    pub rbe_left: *mut key_table,
    pub rbe_right: *mut key_table,
    pub rbe_parent: *mut key_table,
    pub rbe_color: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct key_bindings {
    pub rbh_root: *mut key_binding,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct key_binding {
    pub key: key_code,
    pub cmdlist: *mut cmd_list,
    pub note: *const libc::c_char,
    pub flags: libc::c_int,
    pub entry: C2RustUnnamed_30,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_30 {
    pub rbe_left: *mut key_binding,
    pub rbe_right: *mut key_binding,
    pub rbe_parent: *mut key_binding,
    pub rbe_color: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_list {
    pub references: libc::c_int,
    pub group: u_int,
    pub list: *mut cmds,
}
pub type C2RustUnnamed_31 = libc::c_uint;
pub const CLIENT_EXIT_DETACH: C2RustUnnamed_31 = 2;
pub const CLIENT_EXIT_SHUTDOWN: C2RustUnnamed_31 = 1;
pub const CLIENT_EXIT_RETURN: C2RustUnnamed_31 = 0;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct status_line {
    pub timer: event,
    pub screen: screen,
    pub active: *mut screen,
    pub references: libc::c_int,
    pub style: grid_cell,
    pub entries: [status_line_entry; 5],
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct status_line_entry {
    pub expanded: *mut libc::c_char,
    pub ranges: style_ranges,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct style_ranges {
    pub tqh_first: *mut style_range,
    pub tqh_last: *mut *mut style_range,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct style_range {
    pub type_0: style_range_type,
    pub argument: u_int,
    pub string: [libc::c_char; 16],
    pub start: u_int,
    pub end: u_int,
    pub entry: C2RustUnnamed_32,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_32 {
    pub tqe_next: *mut style_range,
    pub tqe_prev: *mut *mut style_range,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct tty {
    pub client: *mut client,
    pub start_timer: event,
    pub clipboard_timer: event,
    pub last_requests: time_t,
    pub sx: u_int,
    pub sy: u_int,
    pub xpixel: u_int,
    pub ypixel: u_int,
    pub cx: u_int,
    pub cy: u_int,
    pub cstyle: screen_cursor_style,
    pub ccolour: libc::c_int,
    pub oflag: libc::c_int,
    pub oox: u_int,
    pub ooy: u_int,
    pub osx: u_int,
    pub osy: u_int,
    pub mode: libc::c_int,
    pub fg: libc::c_int,
    pub bg: libc::c_int,
    pub rlower: u_int,
    pub rupper: u_int,
    pub rleft: u_int,
    pub rright: u_int,
    pub event_in: event,
    pub in_0: *mut evbuffer,
    pub event_out: event,
    pub out: *mut evbuffer,
    pub timer: event,
    pub discarded: size_t,
    pub tio: termios,
    pub cell: grid_cell,
    pub last_cell: grid_cell,
    pub flags: libc::c_int,
    pub term: *mut tty_term,
    pub mouse_last_x: u_int,
    pub mouse_last_y: u_int,
    pub mouse_last_b: u_int,
    pub mouse_drag_flag: libc::c_int,
    pub mouse_scrolling_flag: libc::c_int,
    pub mouse_slider_mpos: libc::c_int,
    pub mouse_drag_update: Option<unsafe extern "C" fn(*mut client, *mut mouse_event) -> ()>,
    pub mouse_drag_release: Option<unsafe extern "C" fn(*mut client, *mut mouse_event) -> ()>,
    pub key_timer: event,
    pub key_tree: *mut tty_key,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct tty_term {
    pub name: *mut libc::c_char,
    pub tty: *mut tty,
    pub features: libc::c_int,
    pub acs: [[libc::c_char; 2]; 256],
    pub codes: *mut tty_code,
    pub flags: libc::c_int,
    pub entry: C2RustUnnamed_33,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_33 {
    pub le_next: *mut tty_term,
    pub le_prev: *mut *mut tty_term,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct client_windows {
    pub rbh_root: *mut client_window,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct client_window {
    pub window: u_int,
    pub pane: *mut window_pane,
    pub sx: u_int,
    pub sy: u_int,
    pub entry: C2RustUnnamed_34,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_34 {
    pub rbe_left: *mut client_window,
    pub rbe_right: *mut client_window,
    pub rbe_parent: *mut client_window,
    pub rbe_color: libc::c_int,
}
pub type C2RustUnnamed_35 = libc::c_uint;
pub const KEYC_BASE_END: C2RustUnnamed_35 = 1106562;
pub const KEYC_KP_PERIOD: C2RustUnnamed_35 = 1106561;
pub const KEYC_KP_ZERO: C2RustUnnamed_35 = 1106560;
pub const KEYC_KP_ENTER: C2RustUnnamed_35 = 1106559;
pub const KEYC_KP_THREE: C2RustUnnamed_35 = 1106558;
pub const KEYC_KP_TWO: C2RustUnnamed_35 = 1106557;
pub const KEYC_KP_ONE: C2RustUnnamed_35 = 1106556;
pub const KEYC_KP_SIX: C2RustUnnamed_35 = 1106555;
pub const KEYC_KP_FIVE: C2RustUnnamed_35 = 1106554;
pub const KEYC_KP_FOUR: C2RustUnnamed_35 = 1106553;
pub const KEYC_KP_PLUS: C2RustUnnamed_35 = 1106552;
pub const KEYC_KP_NINE: C2RustUnnamed_35 = 1106551;
pub const KEYC_KP_EIGHT: C2RustUnnamed_35 = 1106550;
pub const KEYC_KP_SEVEN: C2RustUnnamed_35 = 1106549;
pub const KEYC_KP_MINUS: C2RustUnnamed_35 = 1106548;
pub const KEYC_KP_STAR: C2RustUnnamed_35 = 1106547;
pub const KEYC_KP_SLASH: C2RustUnnamed_35 = 1106546;
pub const KEYC_RIGHT: C2RustUnnamed_35 = 1106545;
pub const KEYC_LEFT: C2RustUnnamed_35 = 1106544;
pub const KEYC_DOWN: C2RustUnnamed_35 = 1106543;
pub const KEYC_UP: C2RustUnnamed_35 = 1106542;
pub const KEYC_BTAB: C2RustUnnamed_35 = 1106541;
pub const KEYC_PPAGE: C2RustUnnamed_35 = 1106540;
pub const KEYC_NPAGE: C2RustUnnamed_35 = 1106539;
pub const KEYC_END: C2RustUnnamed_35 = 1106538;
pub const KEYC_HOME: C2RustUnnamed_35 = 1106537;
pub const KEYC_DC: C2RustUnnamed_35 = 1106536;
pub const KEYC_IC: C2RustUnnamed_35 = 1106535;
pub const KEYC_F12: C2RustUnnamed_35 = 1106534;
pub const KEYC_F11: C2RustUnnamed_35 = 1106533;
pub const KEYC_F10: C2RustUnnamed_35 = 1106532;
pub const KEYC_F9: C2RustUnnamed_35 = 1106531;
pub const KEYC_F8: C2RustUnnamed_35 = 1106530;
pub const KEYC_F7: C2RustUnnamed_35 = 1106529;
pub const KEYC_F6: C2RustUnnamed_35 = 1106528;
pub const KEYC_F5: C2RustUnnamed_35 = 1106527;
pub const KEYC_F4: C2RustUnnamed_35 = 1106526;
pub const KEYC_F3: C2RustUnnamed_35 = 1106525;
pub const KEYC_F2: C2RustUnnamed_35 = 1106524;
pub const KEYC_F1: C2RustUnnamed_35 = 1106523;
pub const KEYC_BSPACE: C2RustUnnamed_35 = 1106522;
pub const KEYC_TRIPLECLICK11_BORDER: C2RustUnnamed_35 = 1106521;
pub const KEYC_TRIPLECLICK11_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106520;
pub const KEYC_TRIPLECLICK11_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106519;
pub const KEYC_TRIPLECLICK11_SCROLLBAR_UP: C2RustUnnamed_35 = 1106518;
pub const KEYC_TRIPLECLICK11_STATUS_DEFAULT: C2RustUnnamed_35 = 1106517;
pub const KEYC_TRIPLECLICK11_STATUS_RIGHT: C2RustUnnamed_35 = 1106516;
pub const KEYC_TRIPLECLICK11_STATUS_LEFT: C2RustUnnamed_35 = 1106515;
pub const KEYC_TRIPLECLICK11_STATUS: C2RustUnnamed_35 = 1106514;
pub const KEYC_TRIPLECLICK11_PANE: C2RustUnnamed_35 = 1106513;
pub const KEYC_TRIPLECLICK10_BORDER: C2RustUnnamed_35 = 1106512;
pub const KEYC_TRIPLECLICK10_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106511;
pub const KEYC_TRIPLECLICK10_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106510;
pub const KEYC_TRIPLECLICK10_SCROLLBAR_UP: C2RustUnnamed_35 = 1106509;
pub const KEYC_TRIPLECLICK10_STATUS_DEFAULT: C2RustUnnamed_35 = 1106508;
pub const KEYC_TRIPLECLICK10_STATUS_RIGHT: C2RustUnnamed_35 = 1106507;
pub const KEYC_TRIPLECLICK10_STATUS_LEFT: C2RustUnnamed_35 = 1106506;
pub const KEYC_TRIPLECLICK10_STATUS: C2RustUnnamed_35 = 1106505;
pub const KEYC_TRIPLECLICK10_PANE: C2RustUnnamed_35 = 1106504;
pub const KEYC_TRIPLECLICK9_BORDER: C2RustUnnamed_35 = 1106503;
pub const KEYC_TRIPLECLICK9_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106502;
pub const KEYC_TRIPLECLICK9_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106501;
pub const KEYC_TRIPLECLICK9_SCROLLBAR_UP: C2RustUnnamed_35 = 1106500;
pub const KEYC_TRIPLECLICK9_STATUS_DEFAULT: C2RustUnnamed_35 = 1106499;
pub const KEYC_TRIPLECLICK9_STATUS_RIGHT: C2RustUnnamed_35 = 1106498;
pub const KEYC_TRIPLECLICK9_STATUS_LEFT: C2RustUnnamed_35 = 1106497;
pub const KEYC_TRIPLECLICK9_STATUS: C2RustUnnamed_35 = 1106496;
pub const KEYC_TRIPLECLICK9_PANE: C2RustUnnamed_35 = 1106495;
pub const KEYC_TRIPLECLICK8_BORDER: C2RustUnnamed_35 = 1106494;
pub const KEYC_TRIPLECLICK8_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106493;
pub const KEYC_TRIPLECLICK8_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106492;
pub const KEYC_TRIPLECLICK8_SCROLLBAR_UP: C2RustUnnamed_35 = 1106491;
pub const KEYC_TRIPLECLICK8_STATUS_DEFAULT: C2RustUnnamed_35 = 1106490;
pub const KEYC_TRIPLECLICK8_STATUS_RIGHT: C2RustUnnamed_35 = 1106489;
pub const KEYC_TRIPLECLICK8_STATUS_LEFT: C2RustUnnamed_35 = 1106488;
pub const KEYC_TRIPLECLICK8_STATUS: C2RustUnnamed_35 = 1106487;
pub const KEYC_TRIPLECLICK8_PANE: C2RustUnnamed_35 = 1106486;
pub const KEYC_TRIPLECLICK7_BORDER: C2RustUnnamed_35 = 1106485;
pub const KEYC_TRIPLECLICK7_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106484;
pub const KEYC_TRIPLECLICK7_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106483;
pub const KEYC_TRIPLECLICK7_SCROLLBAR_UP: C2RustUnnamed_35 = 1106482;
pub const KEYC_TRIPLECLICK7_STATUS_DEFAULT: C2RustUnnamed_35 = 1106481;
pub const KEYC_TRIPLECLICK7_STATUS_RIGHT: C2RustUnnamed_35 = 1106480;
pub const KEYC_TRIPLECLICK7_STATUS_LEFT: C2RustUnnamed_35 = 1106479;
pub const KEYC_TRIPLECLICK7_STATUS: C2RustUnnamed_35 = 1106478;
pub const KEYC_TRIPLECLICK7_PANE: C2RustUnnamed_35 = 1106477;
pub const KEYC_TRIPLECLICK6_BORDER: C2RustUnnamed_35 = 1106476;
pub const KEYC_TRIPLECLICK6_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106475;
pub const KEYC_TRIPLECLICK6_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106474;
pub const KEYC_TRIPLECLICK6_SCROLLBAR_UP: C2RustUnnamed_35 = 1106473;
pub const KEYC_TRIPLECLICK6_STATUS_DEFAULT: C2RustUnnamed_35 = 1106472;
pub const KEYC_TRIPLECLICK6_STATUS_RIGHT: C2RustUnnamed_35 = 1106471;
pub const KEYC_TRIPLECLICK6_STATUS_LEFT: C2RustUnnamed_35 = 1106470;
pub const KEYC_TRIPLECLICK6_STATUS: C2RustUnnamed_35 = 1106469;
pub const KEYC_TRIPLECLICK6_PANE: C2RustUnnamed_35 = 1106468;
pub const KEYC_TRIPLECLICK3_BORDER: C2RustUnnamed_35 = 1106467;
pub const KEYC_TRIPLECLICK3_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106466;
pub const KEYC_TRIPLECLICK3_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106465;
pub const KEYC_TRIPLECLICK3_SCROLLBAR_UP: C2RustUnnamed_35 = 1106464;
pub const KEYC_TRIPLECLICK3_STATUS_DEFAULT: C2RustUnnamed_35 = 1106463;
pub const KEYC_TRIPLECLICK3_STATUS_RIGHT: C2RustUnnamed_35 = 1106462;
pub const KEYC_TRIPLECLICK3_STATUS_LEFT: C2RustUnnamed_35 = 1106461;
pub const KEYC_TRIPLECLICK3_STATUS: C2RustUnnamed_35 = 1106460;
pub const KEYC_TRIPLECLICK3_PANE: C2RustUnnamed_35 = 1106459;
pub const KEYC_TRIPLECLICK2_BORDER: C2RustUnnamed_35 = 1106458;
pub const KEYC_TRIPLECLICK2_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106457;
pub const KEYC_TRIPLECLICK2_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106456;
pub const KEYC_TRIPLECLICK2_SCROLLBAR_UP: C2RustUnnamed_35 = 1106455;
pub const KEYC_TRIPLECLICK2_STATUS_DEFAULT: C2RustUnnamed_35 = 1106454;
pub const KEYC_TRIPLECLICK2_STATUS_RIGHT: C2RustUnnamed_35 = 1106453;
pub const KEYC_TRIPLECLICK2_STATUS_LEFT: C2RustUnnamed_35 = 1106452;
pub const KEYC_TRIPLECLICK2_STATUS: C2RustUnnamed_35 = 1106451;
pub const KEYC_TRIPLECLICK2_PANE: C2RustUnnamed_35 = 1106450;
pub const KEYC_TRIPLECLICK1_BORDER: C2RustUnnamed_35 = 1106449;
pub const KEYC_TRIPLECLICK1_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106448;
pub const KEYC_TRIPLECLICK1_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106447;
pub const KEYC_TRIPLECLICK1_SCROLLBAR_UP: C2RustUnnamed_35 = 1106446;
pub const KEYC_TRIPLECLICK1_STATUS_DEFAULT: C2RustUnnamed_35 = 1106445;
pub const KEYC_TRIPLECLICK1_STATUS_RIGHT: C2RustUnnamed_35 = 1106444;
pub const KEYC_TRIPLECLICK1_STATUS_LEFT: C2RustUnnamed_35 = 1106443;
pub const KEYC_TRIPLECLICK1_STATUS: C2RustUnnamed_35 = 1106442;
pub const KEYC_TRIPLECLICK1_PANE: C2RustUnnamed_35 = 1106441;
pub const KEYC_DOUBLECLICK11_BORDER: C2RustUnnamed_35 = 1106440;
pub const KEYC_DOUBLECLICK11_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106439;
pub const KEYC_DOUBLECLICK11_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106438;
pub const KEYC_DOUBLECLICK11_SCROLLBAR_UP: C2RustUnnamed_35 = 1106437;
pub const KEYC_DOUBLECLICK11_STATUS_DEFAULT: C2RustUnnamed_35 = 1106436;
pub const KEYC_DOUBLECLICK11_STATUS_RIGHT: C2RustUnnamed_35 = 1106435;
pub const KEYC_DOUBLECLICK11_STATUS_LEFT: C2RustUnnamed_35 = 1106434;
pub const KEYC_DOUBLECLICK11_STATUS: C2RustUnnamed_35 = 1106433;
pub const KEYC_DOUBLECLICK11_PANE: C2RustUnnamed_35 = 1106432;
pub const KEYC_DOUBLECLICK10_BORDER: C2RustUnnamed_35 = 1106431;
pub const KEYC_DOUBLECLICK10_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106430;
pub const KEYC_DOUBLECLICK10_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106429;
pub const KEYC_DOUBLECLICK10_SCROLLBAR_UP: C2RustUnnamed_35 = 1106428;
pub const KEYC_DOUBLECLICK10_STATUS_DEFAULT: C2RustUnnamed_35 = 1106427;
pub const KEYC_DOUBLECLICK10_STATUS_RIGHT: C2RustUnnamed_35 = 1106426;
pub const KEYC_DOUBLECLICK10_STATUS_LEFT: C2RustUnnamed_35 = 1106425;
pub const KEYC_DOUBLECLICK10_STATUS: C2RustUnnamed_35 = 1106424;
pub const KEYC_DOUBLECLICK10_PANE: C2RustUnnamed_35 = 1106423;
pub const KEYC_DOUBLECLICK9_BORDER: C2RustUnnamed_35 = 1106422;
pub const KEYC_DOUBLECLICK9_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106421;
pub const KEYC_DOUBLECLICK9_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106420;
pub const KEYC_DOUBLECLICK9_SCROLLBAR_UP: C2RustUnnamed_35 = 1106419;
pub const KEYC_DOUBLECLICK9_STATUS_DEFAULT: C2RustUnnamed_35 = 1106418;
pub const KEYC_DOUBLECLICK9_STATUS_RIGHT: C2RustUnnamed_35 = 1106417;
pub const KEYC_DOUBLECLICK9_STATUS_LEFT: C2RustUnnamed_35 = 1106416;
pub const KEYC_DOUBLECLICK9_STATUS: C2RustUnnamed_35 = 1106415;
pub const KEYC_DOUBLECLICK9_PANE: C2RustUnnamed_35 = 1106414;
pub const KEYC_DOUBLECLICK8_BORDER: C2RustUnnamed_35 = 1106413;
pub const KEYC_DOUBLECLICK8_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106412;
pub const KEYC_DOUBLECLICK8_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106411;
pub const KEYC_DOUBLECLICK8_SCROLLBAR_UP: C2RustUnnamed_35 = 1106410;
pub const KEYC_DOUBLECLICK8_STATUS_DEFAULT: C2RustUnnamed_35 = 1106409;
pub const KEYC_DOUBLECLICK8_STATUS_RIGHT: C2RustUnnamed_35 = 1106408;
pub const KEYC_DOUBLECLICK8_STATUS_LEFT: C2RustUnnamed_35 = 1106407;
pub const KEYC_DOUBLECLICK8_STATUS: C2RustUnnamed_35 = 1106406;
pub const KEYC_DOUBLECLICK8_PANE: C2RustUnnamed_35 = 1106405;
pub const KEYC_DOUBLECLICK7_BORDER: C2RustUnnamed_35 = 1106404;
pub const KEYC_DOUBLECLICK7_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106403;
pub const KEYC_DOUBLECLICK7_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106402;
pub const KEYC_DOUBLECLICK7_SCROLLBAR_UP: C2RustUnnamed_35 = 1106401;
pub const KEYC_DOUBLECLICK7_STATUS_DEFAULT: C2RustUnnamed_35 = 1106400;
pub const KEYC_DOUBLECLICK7_STATUS_RIGHT: C2RustUnnamed_35 = 1106399;
pub const KEYC_DOUBLECLICK7_STATUS_LEFT: C2RustUnnamed_35 = 1106398;
pub const KEYC_DOUBLECLICK7_STATUS: C2RustUnnamed_35 = 1106397;
pub const KEYC_DOUBLECLICK7_PANE: C2RustUnnamed_35 = 1106396;
pub const KEYC_DOUBLECLICK6_BORDER: C2RustUnnamed_35 = 1106395;
pub const KEYC_DOUBLECLICK6_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106394;
pub const KEYC_DOUBLECLICK6_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106393;
pub const KEYC_DOUBLECLICK6_SCROLLBAR_UP: C2RustUnnamed_35 = 1106392;
pub const KEYC_DOUBLECLICK6_STATUS_DEFAULT: C2RustUnnamed_35 = 1106391;
pub const KEYC_DOUBLECLICK6_STATUS_RIGHT: C2RustUnnamed_35 = 1106390;
pub const KEYC_DOUBLECLICK6_STATUS_LEFT: C2RustUnnamed_35 = 1106389;
pub const KEYC_DOUBLECLICK6_STATUS: C2RustUnnamed_35 = 1106388;
pub const KEYC_DOUBLECLICK6_PANE: C2RustUnnamed_35 = 1106387;
pub const KEYC_DOUBLECLICK3_BORDER: C2RustUnnamed_35 = 1106386;
pub const KEYC_DOUBLECLICK3_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106385;
pub const KEYC_DOUBLECLICK3_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106384;
pub const KEYC_DOUBLECLICK3_SCROLLBAR_UP: C2RustUnnamed_35 = 1106383;
pub const KEYC_DOUBLECLICK3_STATUS_DEFAULT: C2RustUnnamed_35 = 1106382;
pub const KEYC_DOUBLECLICK3_STATUS_RIGHT: C2RustUnnamed_35 = 1106381;
pub const KEYC_DOUBLECLICK3_STATUS_LEFT: C2RustUnnamed_35 = 1106380;
pub const KEYC_DOUBLECLICK3_STATUS: C2RustUnnamed_35 = 1106379;
pub const KEYC_DOUBLECLICK3_PANE: C2RustUnnamed_35 = 1106378;
pub const KEYC_DOUBLECLICK2_BORDER: C2RustUnnamed_35 = 1106377;
pub const KEYC_DOUBLECLICK2_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106376;
pub const KEYC_DOUBLECLICK2_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106375;
pub const KEYC_DOUBLECLICK2_SCROLLBAR_UP: C2RustUnnamed_35 = 1106374;
pub const KEYC_DOUBLECLICK2_STATUS_DEFAULT: C2RustUnnamed_35 = 1106373;
pub const KEYC_DOUBLECLICK2_STATUS_RIGHT: C2RustUnnamed_35 = 1106372;
pub const KEYC_DOUBLECLICK2_STATUS_LEFT: C2RustUnnamed_35 = 1106371;
pub const KEYC_DOUBLECLICK2_STATUS: C2RustUnnamed_35 = 1106370;
pub const KEYC_DOUBLECLICK2_PANE: C2RustUnnamed_35 = 1106369;
pub const KEYC_DOUBLECLICK1_BORDER: C2RustUnnamed_35 = 1106368;
pub const KEYC_DOUBLECLICK1_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106367;
pub const KEYC_DOUBLECLICK1_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106366;
pub const KEYC_DOUBLECLICK1_SCROLLBAR_UP: C2RustUnnamed_35 = 1106365;
pub const KEYC_DOUBLECLICK1_STATUS_DEFAULT: C2RustUnnamed_35 = 1106364;
pub const KEYC_DOUBLECLICK1_STATUS_RIGHT: C2RustUnnamed_35 = 1106363;
pub const KEYC_DOUBLECLICK1_STATUS_LEFT: C2RustUnnamed_35 = 1106362;
pub const KEYC_DOUBLECLICK1_STATUS: C2RustUnnamed_35 = 1106361;
pub const KEYC_DOUBLECLICK1_PANE: C2RustUnnamed_35 = 1106360;
pub const KEYC_SECONDCLICK11_BORDER: C2RustUnnamed_35 = 1106359;
pub const KEYC_SECONDCLICK11_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106358;
pub const KEYC_SECONDCLICK11_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106357;
pub const KEYC_SECONDCLICK11_SCROLLBAR_UP: C2RustUnnamed_35 = 1106356;
pub const KEYC_SECONDCLICK11_STATUS_DEFAULT: C2RustUnnamed_35 = 1106355;
pub const KEYC_SECONDCLICK11_STATUS_RIGHT: C2RustUnnamed_35 = 1106354;
pub const KEYC_SECONDCLICK11_STATUS_LEFT: C2RustUnnamed_35 = 1106353;
pub const KEYC_SECONDCLICK11_STATUS: C2RustUnnamed_35 = 1106352;
pub const KEYC_SECONDCLICK11_PANE: C2RustUnnamed_35 = 1106351;
pub const KEYC_SECONDCLICK10_BORDER: C2RustUnnamed_35 = 1106350;
pub const KEYC_SECONDCLICK10_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106349;
pub const KEYC_SECONDCLICK10_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106348;
pub const KEYC_SECONDCLICK10_SCROLLBAR_UP: C2RustUnnamed_35 = 1106347;
pub const KEYC_SECONDCLICK10_STATUS_DEFAULT: C2RustUnnamed_35 = 1106346;
pub const KEYC_SECONDCLICK10_STATUS_RIGHT: C2RustUnnamed_35 = 1106345;
pub const KEYC_SECONDCLICK10_STATUS_LEFT: C2RustUnnamed_35 = 1106344;
pub const KEYC_SECONDCLICK10_STATUS: C2RustUnnamed_35 = 1106343;
pub const KEYC_SECONDCLICK10_PANE: C2RustUnnamed_35 = 1106342;
pub const KEYC_SECONDCLICK9_BORDER: C2RustUnnamed_35 = 1106341;
pub const KEYC_SECONDCLICK9_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106340;
pub const KEYC_SECONDCLICK9_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106339;
pub const KEYC_SECONDCLICK9_SCROLLBAR_UP: C2RustUnnamed_35 = 1106338;
pub const KEYC_SECONDCLICK9_STATUS_DEFAULT: C2RustUnnamed_35 = 1106337;
pub const KEYC_SECONDCLICK9_STATUS_RIGHT: C2RustUnnamed_35 = 1106336;
pub const KEYC_SECONDCLICK9_STATUS_LEFT: C2RustUnnamed_35 = 1106335;
pub const KEYC_SECONDCLICK9_STATUS: C2RustUnnamed_35 = 1106334;
pub const KEYC_SECONDCLICK9_PANE: C2RustUnnamed_35 = 1106333;
pub const KEYC_SECONDCLICK8_BORDER: C2RustUnnamed_35 = 1106332;
pub const KEYC_SECONDCLICK8_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106331;
pub const KEYC_SECONDCLICK8_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106330;
pub const KEYC_SECONDCLICK8_SCROLLBAR_UP: C2RustUnnamed_35 = 1106329;
pub const KEYC_SECONDCLICK8_STATUS_DEFAULT: C2RustUnnamed_35 = 1106328;
pub const KEYC_SECONDCLICK8_STATUS_RIGHT: C2RustUnnamed_35 = 1106327;
pub const KEYC_SECONDCLICK8_STATUS_LEFT: C2RustUnnamed_35 = 1106326;
pub const KEYC_SECONDCLICK8_STATUS: C2RustUnnamed_35 = 1106325;
pub const KEYC_SECONDCLICK8_PANE: C2RustUnnamed_35 = 1106324;
pub const KEYC_SECONDCLICK7_BORDER: C2RustUnnamed_35 = 1106323;
pub const KEYC_SECONDCLICK7_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106322;
pub const KEYC_SECONDCLICK7_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106321;
pub const KEYC_SECONDCLICK7_SCROLLBAR_UP: C2RustUnnamed_35 = 1106320;
pub const KEYC_SECONDCLICK7_STATUS_DEFAULT: C2RustUnnamed_35 = 1106319;
pub const KEYC_SECONDCLICK7_STATUS_RIGHT: C2RustUnnamed_35 = 1106318;
pub const KEYC_SECONDCLICK7_STATUS_LEFT: C2RustUnnamed_35 = 1106317;
pub const KEYC_SECONDCLICK7_STATUS: C2RustUnnamed_35 = 1106316;
pub const KEYC_SECONDCLICK7_PANE: C2RustUnnamed_35 = 1106315;
pub const KEYC_SECONDCLICK6_BORDER: C2RustUnnamed_35 = 1106314;
pub const KEYC_SECONDCLICK6_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106313;
pub const KEYC_SECONDCLICK6_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106312;
pub const KEYC_SECONDCLICK6_SCROLLBAR_UP: C2RustUnnamed_35 = 1106311;
pub const KEYC_SECONDCLICK6_STATUS_DEFAULT: C2RustUnnamed_35 = 1106310;
pub const KEYC_SECONDCLICK6_STATUS_RIGHT: C2RustUnnamed_35 = 1106309;
pub const KEYC_SECONDCLICK6_STATUS_LEFT: C2RustUnnamed_35 = 1106308;
pub const KEYC_SECONDCLICK6_STATUS: C2RustUnnamed_35 = 1106307;
pub const KEYC_SECONDCLICK6_PANE: C2RustUnnamed_35 = 1106306;
pub const KEYC_SECONDCLICK3_BORDER: C2RustUnnamed_35 = 1106305;
pub const KEYC_SECONDCLICK3_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106304;
pub const KEYC_SECONDCLICK3_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106303;
pub const KEYC_SECONDCLICK3_SCROLLBAR_UP: C2RustUnnamed_35 = 1106302;
pub const KEYC_SECONDCLICK3_STATUS_DEFAULT: C2RustUnnamed_35 = 1106301;
pub const KEYC_SECONDCLICK3_STATUS_RIGHT: C2RustUnnamed_35 = 1106300;
pub const KEYC_SECONDCLICK3_STATUS_LEFT: C2RustUnnamed_35 = 1106299;
pub const KEYC_SECONDCLICK3_STATUS: C2RustUnnamed_35 = 1106298;
pub const KEYC_SECONDCLICK3_PANE: C2RustUnnamed_35 = 1106297;
pub const KEYC_SECONDCLICK2_BORDER: C2RustUnnamed_35 = 1106296;
pub const KEYC_SECONDCLICK2_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106295;
pub const KEYC_SECONDCLICK2_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106294;
pub const KEYC_SECONDCLICK2_SCROLLBAR_UP: C2RustUnnamed_35 = 1106293;
pub const KEYC_SECONDCLICK2_STATUS_DEFAULT: C2RustUnnamed_35 = 1106292;
pub const KEYC_SECONDCLICK2_STATUS_RIGHT: C2RustUnnamed_35 = 1106291;
pub const KEYC_SECONDCLICK2_STATUS_LEFT: C2RustUnnamed_35 = 1106290;
pub const KEYC_SECONDCLICK2_STATUS: C2RustUnnamed_35 = 1106289;
pub const KEYC_SECONDCLICK2_PANE: C2RustUnnamed_35 = 1106288;
pub const KEYC_SECONDCLICK1_BORDER: C2RustUnnamed_35 = 1106287;
pub const KEYC_SECONDCLICK1_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106286;
pub const KEYC_SECONDCLICK1_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106285;
pub const KEYC_SECONDCLICK1_SCROLLBAR_UP: C2RustUnnamed_35 = 1106284;
pub const KEYC_SECONDCLICK1_STATUS_DEFAULT: C2RustUnnamed_35 = 1106283;
pub const KEYC_SECONDCLICK1_STATUS_RIGHT: C2RustUnnamed_35 = 1106282;
pub const KEYC_SECONDCLICK1_STATUS_LEFT: C2RustUnnamed_35 = 1106281;
pub const KEYC_SECONDCLICK1_STATUS: C2RustUnnamed_35 = 1106280;
pub const KEYC_SECONDCLICK1_PANE: C2RustUnnamed_35 = 1106279;
pub const KEYC_WHEELDOWN_BORDER: C2RustUnnamed_35 = 1106278;
pub const KEYC_WHEELDOWN_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106277;
pub const KEYC_WHEELDOWN_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106276;
pub const KEYC_WHEELDOWN_SCROLLBAR_UP: C2RustUnnamed_35 = 1106275;
pub const KEYC_WHEELDOWN_STATUS_DEFAULT: C2RustUnnamed_35 = 1106274;
pub const KEYC_WHEELDOWN_STATUS_RIGHT: C2RustUnnamed_35 = 1106273;
pub const KEYC_WHEELDOWN_STATUS_LEFT: C2RustUnnamed_35 = 1106272;
pub const KEYC_WHEELDOWN_STATUS: C2RustUnnamed_35 = 1106271;
pub const KEYC_WHEELDOWN_PANE: C2RustUnnamed_35 = 1106270;
pub const KEYC_WHEELUP_BORDER: C2RustUnnamed_35 = 1106269;
pub const KEYC_WHEELUP_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106268;
pub const KEYC_WHEELUP_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106267;
pub const KEYC_WHEELUP_SCROLLBAR_UP: C2RustUnnamed_35 = 1106266;
pub const KEYC_WHEELUP_STATUS_DEFAULT: C2RustUnnamed_35 = 1106265;
pub const KEYC_WHEELUP_STATUS_RIGHT: C2RustUnnamed_35 = 1106264;
pub const KEYC_WHEELUP_STATUS_LEFT: C2RustUnnamed_35 = 1106263;
pub const KEYC_WHEELUP_STATUS: C2RustUnnamed_35 = 1106262;
pub const KEYC_WHEELUP_PANE: C2RustUnnamed_35 = 1106261;
pub const KEYC_MOUSEDRAGEND11_BORDER: C2RustUnnamed_35 = 1106260;
pub const KEYC_MOUSEDRAGEND11_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106259;
pub const KEYC_MOUSEDRAGEND11_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106258;
pub const KEYC_MOUSEDRAGEND11_SCROLLBAR_UP: C2RustUnnamed_35 = 1106257;
pub const KEYC_MOUSEDRAGEND11_STATUS_DEFAULT: C2RustUnnamed_35 = 1106256;
pub const KEYC_MOUSEDRAGEND11_STATUS_RIGHT: C2RustUnnamed_35 = 1106255;
pub const KEYC_MOUSEDRAGEND11_STATUS_LEFT: C2RustUnnamed_35 = 1106254;
pub const KEYC_MOUSEDRAGEND11_STATUS: C2RustUnnamed_35 = 1106253;
pub const KEYC_MOUSEDRAGEND11_PANE: C2RustUnnamed_35 = 1106252;
pub const KEYC_MOUSEDRAGEND10_BORDER: C2RustUnnamed_35 = 1106251;
pub const KEYC_MOUSEDRAGEND10_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106250;
pub const KEYC_MOUSEDRAGEND10_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106249;
pub const KEYC_MOUSEDRAGEND10_SCROLLBAR_UP: C2RustUnnamed_35 = 1106248;
pub const KEYC_MOUSEDRAGEND10_STATUS_DEFAULT: C2RustUnnamed_35 = 1106247;
pub const KEYC_MOUSEDRAGEND10_STATUS_RIGHT: C2RustUnnamed_35 = 1106246;
pub const KEYC_MOUSEDRAGEND10_STATUS_LEFT: C2RustUnnamed_35 = 1106245;
pub const KEYC_MOUSEDRAGEND10_STATUS: C2RustUnnamed_35 = 1106244;
pub const KEYC_MOUSEDRAGEND10_PANE: C2RustUnnamed_35 = 1106243;
pub const KEYC_MOUSEDRAGEND9_BORDER: C2RustUnnamed_35 = 1106242;
pub const KEYC_MOUSEDRAGEND9_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106241;
pub const KEYC_MOUSEDRAGEND9_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106240;
pub const KEYC_MOUSEDRAGEND9_SCROLLBAR_UP: C2RustUnnamed_35 = 1106239;
pub const KEYC_MOUSEDRAGEND9_STATUS_DEFAULT: C2RustUnnamed_35 = 1106238;
pub const KEYC_MOUSEDRAGEND9_STATUS_RIGHT: C2RustUnnamed_35 = 1106237;
pub const KEYC_MOUSEDRAGEND9_STATUS_LEFT: C2RustUnnamed_35 = 1106236;
pub const KEYC_MOUSEDRAGEND9_STATUS: C2RustUnnamed_35 = 1106235;
pub const KEYC_MOUSEDRAGEND9_PANE: C2RustUnnamed_35 = 1106234;
pub const KEYC_MOUSEDRAGEND8_BORDER: C2RustUnnamed_35 = 1106233;
pub const KEYC_MOUSEDRAGEND8_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106232;
pub const KEYC_MOUSEDRAGEND8_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106231;
pub const KEYC_MOUSEDRAGEND8_SCROLLBAR_UP: C2RustUnnamed_35 = 1106230;
pub const KEYC_MOUSEDRAGEND8_STATUS_DEFAULT: C2RustUnnamed_35 = 1106229;
pub const KEYC_MOUSEDRAGEND8_STATUS_RIGHT: C2RustUnnamed_35 = 1106228;
pub const KEYC_MOUSEDRAGEND8_STATUS_LEFT: C2RustUnnamed_35 = 1106227;
pub const KEYC_MOUSEDRAGEND8_STATUS: C2RustUnnamed_35 = 1106226;
pub const KEYC_MOUSEDRAGEND8_PANE: C2RustUnnamed_35 = 1106225;
pub const KEYC_MOUSEDRAGEND7_BORDER: C2RustUnnamed_35 = 1106224;
pub const KEYC_MOUSEDRAGEND7_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106223;
pub const KEYC_MOUSEDRAGEND7_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106222;
pub const KEYC_MOUSEDRAGEND7_SCROLLBAR_UP: C2RustUnnamed_35 = 1106221;
pub const KEYC_MOUSEDRAGEND7_STATUS_DEFAULT: C2RustUnnamed_35 = 1106220;
pub const KEYC_MOUSEDRAGEND7_STATUS_RIGHT: C2RustUnnamed_35 = 1106219;
pub const KEYC_MOUSEDRAGEND7_STATUS_LEFT: C2RustUnnamed_35 = 1106218;
pub const KEYC_MOUSEDRAGEND7_STATUS: C2RustUnnamed_35 = 1106217;
pub const KEYC_MOUSEDRAGEND7_PANE: C2RustUnnamed_35 = 1106216;
pub const KEYC_MOUSEDRAGEND6_BORDER: C2RustUnnamed_35 = 1106215;
pub const KEYC_MOUSEDRAGEND6_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106214;
pub const KEYC_MOUSEDRAGEND6_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106213;
pub const KEYC_MOUSEDRAGEND6_SCROLLBAR_UP: C2RustUnnamed_35 = 1106212;
pub const KEYC_MOUSEDRAGEND6_STATUS_DEFAULT: C2RustUnnamed_35 = 1106211;
pub const KEYC_MOUSEDRAGEND6_STATUS_RIGHT: C2RustUnnamed_35 = 1106210;
pub const KEYC_MOUSEDRAGEND6_STATUS_LEFT: C2RustUnnamed_35 = 1106209;
pub const KEYC_MOUSEDRAGEND6_STATUS: C2RustUnnamed_35 = 1106208;
pub const KEYC_MOUSEDRAGEND6_PANE: C2RustUnnamed_35 = 1106207;
pub const KEYC_MOUSEDRAGEND3_BORDER: C2RustUnnamed_35 = 1106206;
pub const KEYC_MOUSEDRAGEND3_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106205;
pub const KEYC_MOUSEDRAGEND3_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106204;
pub const KEYC_MOUSEDRAGEND3_SCROLLBAR_UP: C2RustUnnamed_35 = 1106203;
pub const KEYC_MOUSEDRAGEND3_STATUS_DEFAULT: C2RustUnnamed_35 = 1106202;
pub const KEYC_MOUSEDRAGEND3_STATUS_RIGHT: C2RustUnnamed_35 = 1106201;
pub const KEYC_MOUSEDRAGEND3_STATUS_LEFT: C2RustUnnamed_35 = 1106200;
pub const KEYC_MOUSEDRAGEND3_STATUS: C2RustUnnamed_35 = 1106199;
pub const KEYC_MOUSEDRAGEND3_PANE: C2RustUnnamed_35 = 1106198;
pub const KEYC_MOUSEDRAGEND2_BORDER: C2RustUnnamed_35 = 1106197;
pub const KEYC_MOUSEDRAGEND2_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106196;
pub const KEYC_MOUSEDRAGEND2_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106195;
pub const KEYC_MOUSEDRAGEND2_SCROLLBAR_UP: C2RustUnnamed_35 = 1106194;
pub const KEYC_MOUSEDRAGEND2_STATUS_DEFAULT: C2RustUnnamed_35 = 1106193;
pub const KEYC_MOUSEDRAGEND2_STATUS_RIGHT: C2RustUnnamed_35 = 1106192;
pub const KEYC_MOUSEDRAGEND2_STATUS_LEFT: C2RustUnnamed_35 = 1106191;
pub const KEYC_MOUSEDRAGEND2_STATUS: C2RustUnnamed_35 = 1106190;
pub const KEYC_MOUSEDRAGEND2_PANE: C2RustUnnamed_35 = 1106189;
pub const KEYC_MOUSEDRAGEND1_BORDER: C2RustUnnamed_35 = 1106188;
pub const KEYC_MOUSEDRAGEND1_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106187;
pub const KEYC_MOUSEDRAGEND1_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106186;
pub const KEYC_MOUSEDRAGEND1_SCROLLBAR_UP: C2RustUnnamed_35 = 1106185;
pub const KEYC_MOUSEDRAGEND1_STATUS_DEFAULT: C2RustUnnamed_35 = 1106184;
pub const KEYC_MOUSEDRAGEND1_STATUS_RIGHT: C2RustUnnamed_35 = 1106183;
pub const KEYC_MOUSEDRAGEND1_STATUS_LEFT: C2RustUnnamed_35 = 1106182;
pub const KEYC_MOUSEDRAGEND1_STATUS: C2RustUnnamed_35 = 1106181;
pub const KEYC_MOUSEDRAGEND1_PANE: C2RustUnnamed_35 = 1106180;
pub const KEYC_MOUSEDRAG11_BORDER: C2RustUnnamed_35 = 1106179;
pub const KEYC_MOUSEDRAG11_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106178;
pub const KEYC_MOUSEDRAG11_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106177;
pub const KEYC_MOUSEDRAG11_SCROLLBAR_UP: C2RustUnnamed_35 = 1106176;
pub const KEYC_MOUSEDRAG11_STATUS_DEFAULT: C2RustUnnamed_35 = 1106175;
pub const KEYC_MOUSEDRAG11_STATUS_RIGHT: C2RustUnnamed_35 = 1106174;
pub const KEYC_MOUSEDRAG11_STATUS_LEFT: C2RustUnnamed_35 = 1106173;
pub const KEYC_MOUSEDRAG11_STATUS: C2RustUnnamed_35 = 1106172;
pub const KEYC_MOUSEDRAG11_PANE: C2RustUnnamed_35 = 1106171;
pub const KEYC_MOUSEDRAG10_BORDER: C2RustUnnamed_35 = 1106170;
pub const KEYC_MOUSEDRAG10_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106169;
pub const KEYC_MOUSEDRAG10_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106168;
pub const KEYC_MOUSEDRAG10_SCROLLBAR_UP: C2RustUnnamed_35 = 1106167;
pub const KEYC_MOUSEDRAG10_STATUS_DEFAULT: C2RustUnnamed_35 = 1106166;
pub const KEYC_MOUSEDRAG10_STATUS_RIGHT: C2RustUnnamed_35 = 1106165;
pub const KEYC_MOUSEDRAG10_STATUS_LEFT: C2RustUnnamed_35 = 1106164;
pub const KEYC_MOUSEDRAG10_STATUS: C2RustUnnamed_35 = 1106163;
pub const KEYC_MOUSEDRAG10_PANE: C2RustUnnamed_35 = 1106162;
pub const KEYC_MOUSEDRAG9_BORDER: C2RustUnnamed_35 = 1106161;
pub const KEYC_MOUSEDRAG9_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106160;
pub const KEYC_MOUSEDRAG9_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106159;
pub const KEYC_MOUSEDRAG9_SCROLLBAR_UP: C2RustUnnamed_35 = 1106158;
pub const KEYC_MOUSEDRAG9_STATUS_DEFAULT: C2RustUnnamed_35 = 1106157;
pub const KEYC_MOUSEDRAG9_STATUS_RIGHT: C2RustUnnamed_35 = 1106156;
pub const KEYC_MOUSEDRAG9_STATUS_LEFT: C2RustUnnamed_35 = 1106155;
pub const KEYC_MOUSEDRAG9_STATUS: C2RustUnnamed_35 = 1106154;
pub const KEYC_MOUSEDRAG9_PANE: C2RustUnnamed_35 = 1106153;
pub const KEYC_MOUSEDRAG8_BORDER: C2RustUnnamed_35 = 1106152;
pub const KEYC_MOUSEDRAG8_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106151;
pub const KEYC_MOUSEDRAG8_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106150;
pub const KEYC_MOUSEDRAG8_SCROLLBAR_UP: C2RustUnnamed_35 = 1106149;
pub const KEYC_MOUSEDRAG8_STATUS_DEFAULT: C2RustUnnamed_35 = 1106148;
pub const KEYC_MOUSEDRAG8_STATUS_RIGHT: C2RustUnnamed_35 = 1106147;
pub const KEYC_MOUSEDRAG8_STATUS_LEFT: C2RustUnnamed_35 = 1106146;
pub const KEYC_MOUSEDRAG8_STATUS: C2RustUnnamed_35 = 1106145;
pub const KEYC_MOUSEDRAG8_PANE: C2RustUnnamed_35 = 1106144;
pub const KEYC_MOUSEDRAG7_BORDER: C2RustUnnamed_35 = 1106143;
pub const KEYC_MOUSEDRAG7_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106142;
pub const KEYC_MOUSEDRAG7_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106141;
pub const KEYC_MOUSEDRAG7_SCROLLBAR_UP: C2RustUnnamed_35 = 1106140;
pub const KEYC_MOUSEDRAG7_STATUS_DEFAULT: C2RustUnnamed_35 = 1106139;
pub const KEYC_MOUSEDRAG7_STATUS_RIGHT: C2RustUnnamed_35 = 1106138;
pub const KEYC_MOUSEDRAG7_STATUS_LEFT: C2RustUnnamed_35 = 1106137;
pub const KEYC_MOUSEDRAG7_STATUS: C2RustUnnamed_35 = 1106136;
pub const KEYC_MOUSEDRAG7_PANE: C2RustUnnamed_35 = 1106135;
pub const KEYC_MOUSEDRAG6_BORDER: C2RustUnnamed_35 = 1106134;
pub const KEYC_MOUSEDRAG6_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106133;
pub const KEYC_MOUSEDRAG6_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106132;
pub const KEYC_MOUSEDRAG6_SCROLLBAR_UP: C2RustUnnamed_35 = 1106131;
pub const KEYC_MOUSEDRAG6_STATUS_DEFAULT: C2RustUnnamed_35 = 1106130;
pub const KEYC_MOUSEDRAG6_STATUS_RIGHT: C2RustUnnamed_35 = 1106129;
pub const KEYC_MOUSEDRAG6_STATUS_LEFT: C2RustUnnamed_35 = 1106128;
pub const KEYC_MOUSEDRAG6_STATUS: C2RustUnnamed_35 = 1106127;
pub const KEYC_MOUSEDRAG6_PANE: C2RustUnnamed_35 = 1106126;
pub const KEYC_MOUSEDRAG3_BORDER: C2RustUnnamed_35 = 1106125;
pub const KEYC_MOUSEDRAG3_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106124;
pub const KEYC_MOUSEDRAG3_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106123;
pub const KEYC_MOUSEDRAG3_SCROLLBAR_UP: C2RustUnnamed_35 = 1106122;
pub const KEYC_MOUSEDRAG3_STATUS_DEFAULT: C2RustUnnamed_35 = 1106121;
pub const KEYC_MOUSEDRAG3_STATUS_RIGHT: C2RustUnnamed_35 = 1106120;
pub const KEYC_MOUSEDRAG3_STATUS_LEFT: C2RustUnnamed_35 = 1106119;
pub const KEYC_MOUSEDRAG3_STATUS: C2RustUnnamed_35 = 1106118;
pub const KEYC_MOUSEDRAG3_PANE: C2RustUnnamed_35 = 1106117;
pub const KEYC_MOUSEDRAG2_BORDER: C2RustUnnamed_35 = 1106116;
pub const KEYC_MOUSEDRAG2_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106115;
pub const KEYC_MOUSEDRAG2_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106114;
pub const KEYC_MOUSEDRAG2_SCROLLBAR_UP: C2RustUnnamed_35 = 1106113;
pub const KEYC_MOUSEDRAG2_STATUS_DEFAULT: C2RustUnnamed_35 = 1106112;
pub const KEYC_MOUSEDRAG2_STATUS_RIGHT: C2RustUnnamed_35 = 1106111;
pub const KEYC_MOUSEDRAG2_STATUS_LEFT: C2RustUnnamed_35 = 1106110;
pub const KEYC_MOUSEDRAG2_STATUS: C2RustUnnamed_35 = 1106109;
pub const KEYC_MOUSEDRAG2_PANE: C2RustUnnamed_35 = 1106108;
pub const KEYC_MOUSEDRAG1_BORDER: C2RustUnnamed_35 = 1106107;
pub const KEYC_MOUSEDRAG1_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106106;
pub const KEYC_MOUSEDRAG1_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106105;
pub const KEYC_MOUSEDRAG1_SCROLLBAR_UP: C2RustUnnamed_35 = 1106104;
pub const KEYC_MOUSEDRAG1_STATUS_DEFAULT: C2RustUnnamed_35 = 1106103;
pub const KEYC_MOUSEDRAG1_STATUS_RIGHT: C2RustUnnamed_35 = 1106102;
pub const KEYC_MOUSEDRAG1_STATUS_LEFT: C2RustUnnamed_35 = 1106101;
pub const KEYC_MOUSEDRAG1_STATUS: C2RustUnnamed_35 = 1106100;
pub const KEYC_MOUSEDRAG1_PANE: C2RustUnnamed_35 = 1106099;
pub const KEYC_MOUSEUP11_BORDER: C2RustUnnamed_35 = 1106098;
pub const KEYC_MOUSEUP11_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106097;
pub const KEYC_MOUSEUP11_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106096;
pub const KEYC_MOUSEUP11_SCROLLBAR_UP: C2RustUnnamed_35 = 1106095;
pub const KEYC_MOUSEUP11_STATUS_DEFAULT: C2RustUnnamed_35 = 1106094;
pub const KEYC_MOUSEUP11_STATUS_RIGHT: C2RustUnnamed_35 = 1106093;
pub const KEYC_MOUSEUP11_STATUS_LEFT: C2RustUnnamed_35 = 1106092;
pub const KEYC_MOUSEUP11_STATUS: C2RustUnnamed_35 = 1106091;
pub const KEYC_MOUSEUP11_PANE: C2RustUnnamed_35 = 1106090;
pub const KEYC_MOUSEUP10_BORDER: C2RustUnnamed_35 = 1106089;
pub const KEYC_MOUSEUP10_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106088;
pub const KEYC_MOUSEUP10_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106087;
pub const KEYC_MOUSEUP10_SCROLLBAR_UP: C2RustUnnamed_35 = 1106086;
pub const KEYC_MOUSEUP10_STATUS_DEFAULT: C2RustUnnamed_35 = 1106085;
pub const KEYC_MOUSEUP10_STATUS_RIGHT: C2RustUnnamed_35 = 1106084;
pub const KEYC_MOUSEUP10_STATUS_LEFT: C2RustUnnamed_35 = 1106083;
pub const KEYC_MOUSEUP10_STATUS: C2RustUnnamed_35 = 1106082;
pub const KEYC_MOUSEUP10_PANE: C2RustUnnamed_35 = 1106081;
pub const KEYC_MOUSEUP9_BORDER: C2RustUnnamed_35 = 1106080;
pub const KEYC_MOUSEUP9_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106079;
pub const KEYC_MOUSEUP9_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106078;
pub const KEYC_MOUSEUP9_SCROLLBAR_UP: C2RustUnnamed_35 = 1106077;
pub const KEYC_MOUSEUP9_STATUS_DEFAULT: C2RustUnnamed_35 = 1106076;
pub const KEYC_MOUSEUP9_STATUS_RIGHT: C2RustUnnamed_35 = 1106075;
pub const KEYC_MOUSEUP9_STATUS_LEFT: C2RustUnnamed_35 = 1106074;
pub const KEYC_MOUSEUP9_STATUS: C2RustUnnamed_35 = 1106073;
pub const KEYC_MOUSEUP9_PANE: C2RustUnnamed_35 = 1106072;
pub const KEYC_MOUSEUP8_BORDER: C2RustUnnamed_35 = 1106071;
pub const KEYC_MOUSEUP8_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106070;
pub const KEYC_MOUSEUP8_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106069;
pub const KEYC_MOUSEUP8_SCROLLBAR_UP: C2RustUnnamed_35 = 1106068;
pub const KEYC_MOUSEUP8_STATUS_DEFAULT: C2RustUnnamed_35 = 1106067;
pub const KEYC_MOUSEUP8_STATUS_RIGHT: C2RustUnnamed_35 = 1106066;
pub const KEYC_MOUSEUP8_STATUS_LEFT: C2RustUnnamed_35 = 1106065;
pub const KEYC_MOUSEUP8_STATUS: C2RustUnnamed_35 = 1106064;
pub const KEYC_MOUSEUP8_PANE: C2RustUnnamed_35 = 1106063;
pub const KEYC_MOUSEUP7_BORDER: C2RustUnnamed_35 = 1106062;
pub const KEYC_MOUSEUP7_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106061;
pub const KEYC_MOUSEUP7_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106060;
pub const KEYC_MOUSEUP7_SCROLLBAR_UP: C2RustUnnamed_35 = 1106059;
pub const KEYC_MOUSEUP7_STATUS_DEFAULT: C2RustUnnamed_35 = 1106058;
pub const KEYC_MOUSEUP7_STATUS_RIGHT: C2RustUnnamed_35 = 1106057;
pub const KEYC_MOUSEUP7_STATUS_LEFT: C2RustUnnamed_35 = 1106056;
pub const KEYC_MOUSEUP7_STATUS: C2RustUnnamed_35 = 1106055;
pub const KEYC_MOUSEUP7_PANE: C2RustUnnamed_35 = 1106054;
pub const KEYC_MOUSEUP6_BORDER: C2RustUnnamed_35 = 1106053;
pub const KEYC_MOUSEUP6_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106052;
pub const KEYC_MOUSEUP6_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106051;
pub const KEYC_MOUSEUP6_SCROLLBAR_UP: C2RustUnnamed_35 = 1106050;
pub const KEYC_MOUSEUP6_STATUS_DEFAULT: C2RustUnnamed_35 = 1106049;
pub const KEYC_MOUSEUP6_STATUS_RIGHT: C2RustUnnamed_35 = 1106048;
pub const KEYC_MOUSEUP6_STATUS_LEFT: C2RustUnnamed_35 = 1106047;
pub const KEYC_MOUSEUP6_STATUS: C2RustUnnamed_35 = 1106046;
pub const KEYC_MOUSEUP6_PANE: C2RustUnnamed_35 = 1106045;
pub const KEYC_MOUSEUP3_BORDER: C2RustUnnamed_35 = 1106044;
pub const KEYC_MOUSEUP3_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106043;
pub const KEYC_MOUSEUP3_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106042;
pub const KEYC_MOUSEUP3_SCROLLBAR_UP: C2RustUnnamed_35 = 1106041;
pub const KEYC_MOUSEUP3_STATUS_DEFAULT: C2RustUnnamed_35 = 1106040;
pub const KEYC_MOUSEUP3_STATUS_RIGHT: C2RustUnnamed_35 = 1106039;
pub const KEYC_MOUSEUP3_STATUS_LEFT: C2RustUnnamed_35 = 1106038;
pub const KEYC_MOUSEUP3_STATUS: C2RustUnnamed_35 = 1106037;
pub const KEYC_MOUSEUP3_PANE: C2RustUnnamed_35 = 1106036;
pub const KEYC_MOUSEUP2_BORDER: C2RustUnnamed_35 = 1106035;
pub const KEYC_MOUSEUP2_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106034;
pub const KEYC_MOUSEUP2_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106033;
pub const KEYC_MOUSEUP2_SCROLLBAR_UP: C2RustUnnamed_35 = 1106032;
pub const KEYC_MOUSEUP2_STATUS_DEFAULT: C2RustUnnamed_35 = 1106031;
pub const KEYC_MOUSEUP2_STATUS_RIGHT: C2RustUnnamed_35 = 1106030;
pub const KEYC_MOUSEUP2_STATUS_LEFT: C2RustUnnamed_35 = 1106029;
pub const KEYC_MOUSEUP2_STATUS: C2RustUnnamed_35 = 1106028;
pub const KEYC_MOUSEUP2_PANE: C2RustUnnamed_35 = 1106027;
pub const KEYC_MOUSEUP1_BORDER: C2RustUnnamed_35 = 1106026;
pub const KEYC_MOUSEUP1_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106025;
pub const KEYC_MOUSEUP1_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106024;
pub const KEYC_MOUSEUP1_SCROLLBAR_UP: C2RustUnnamed_35 = 1106023;
pub const KEYC_MOUSEUP1_STATUS_DEFAULT: C2RustUnnamed_35 = 1106022;
pub const KEYC_MOUSEUP1_STATUS_RIGHT: C2RustUnnamed_35 = 1106021;
pub const KEYC_MOUSEUP1_STATUS_LEFT: C2RustUnnamed_35 = 1106020;
pub const KEYC_MOUSEUP1_STATUS: C2RustUnnamed_35 = 1106019;
pub const KEYC_MOUSEUP1_PANE: C2RustUnnamed_35 = 1106018;
pub const KEYC_MOUSEDOWN11_BORDER: C2RustUnnamed_35 = 1106017;
pub const KEYC_MOUSEDOWN11_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106016;
pub const KEYC_MOUSEDOWN11_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106015;
pub const KEYC_MOUSEDOWN11_SCROLLBAR_UP: C2RustUnnamed_35 = 1106014;
pub const KEYC_MOUSEDOWN11_STATUS_DEFAULT: C2RustUnnamed_35 = 1106013;
pub const KEYC_MOUSEDOWN11_STATUS_RIGHT: C2RustUnnamed_35 = 1106012;
pub const KEYC_MOUSEDOWN11_STATUS_LEFT: C2RustUnnamed_35 = 1106011;
pub const KEYC_MOUSEDOWN11_STATUS: C2RustUnnamed_35 = 1106010;
pub const KEYC_MOUSEDOWN11_PANE: C2RustUnnamed_35 = 1106009;
pub const KEYC_MOUSEDOWN10_BORDER: C2RustUnnamed_35 = 1106008;
pub const KEYC_MOUSEDOWN10_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1106007;
pub const KEYC_MOUSEDOWN10_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1106006;
pub const KEYC_MOUSEDOWN10_SCROLLBAR_UP: C2RustUnnamed_35 = 1106005;
pub const KEYC_MOUSEDOWN10_STATUS_DEFAULT: C2RustUnnamed_35 = 1106004;
pub const KEYC_MOUSEDOWN10_STATUS_RIGHT: C2RustUnnamed_35 = 1106003;
pub const KEYC_MOUSEDOWN10_STATUS_LEFT: C2RustUnnamed_35 = 1106002;
pub const KEYC_MOUSEDOWN10_STATUS: C2RustUnnamed_35 = 1106001;
pub const KEYC_MOUSEDOWN10_PANE: C2RustUnnamed_35 = 1106000;
pub const KEYC_MOUSEDOWN9_BORDER: C2RustUnnamed_35 = 1105999;
pub const KEYC_MOUSEDOWN9_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1105998;
pub const KEYC_MOUSEDOWN9_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1105997;
pub const KEYC_MOUSEDOWN9_SCROLLBAR_UP: C2RustUnnamed_35 = 1105996;
pub const KEYC_MOUSEDOWN9_STATUS_DEFAULT: C2RustUnnamed_35 = 1105995;
pub const KEYC_MOUSEDOWN9_STATUS_RIGHT: C2RustUnnamed_35 = 1105994;
pub const KEYC_MOUSEDOWN9_STATUS_LEFT: C2RustUnnamed_35 = 1105993;
pub const KEYC_MOUSEDOWN9_STATUS: C2RustUnnamed_35 = 1105992;
pub const KEYC_MOUSEDOWN9_PANE: C2RustUnnamed_35 = 1105991;
pub const KEYC_MOUSEDOWN8_BORDER: C2RustUnnamed_35 = 1105990;
pub const KEYC_MOUSEDOWN8_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1105989;
pub const KEYC_MOUSEDOWN8_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1105988;
pub const KEYC_MOUSEDOWN8_SCROLLBAR_UP: C2RustUnnamed_35 = 1105987;
pub const KEYC_MOUSEDOWN8_STATUS_DEFAULT: C2RustUnnamed_35 = 1105986;
pub const KEYC_MOUSEDOWN8_STATUS_RIGHT: C2RustUnnamed_35 = 1105985;
pub const KEYC_MOUSEDOWN8_STATUS_LEFT: C2RustUnnamed_35 = 1105984;
pub const KEYC_MOUSEDOWN8_STATUS: C2RustUnnamed_35 = 1105983;
pub const KEYC_MOUSEDOWN8_PANE: C2RustUnnamed_35 = 1105982;
pub const KEYC_MOUSEDOWN7_BORDER: C2RustUnnamed_35 = 1105981;
pub const KEYC_MOUSEDOWN7_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1105980;
pub const KEYC_MOUSEDOWN7_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1105979;
pub const KEYC_MOUSEDOWN7_SCROLLBAR_UP: C2RustUnnamed_35 = 1105978;
pub const KEYC_MOUSEDOWN7_STATUS_DEFAULT: C2RustUnnamed_35 = 1105977;
pub const KEYC_MOUSEDOWN7_STATUS_RIGHT: C2RustUnnamed_35 = 1105976;
pub const KEYC_MOUSEDOWN7_STATUS_LEFT: C2RustUnnamed_35 = 1105975;
pub const KEYC_MOUSEDOWN7_STATUS: C2RustUnnamed_35 = 1105974;
pub const KEYC_MOUSEDOWN7_PANE: C2RustUnnamed_35 = 1105973;
pub const KEYC_MOUSEDOWN6_BORDER: C2RustUnnamed_35 = 1105972;
pub const KEYC_MOUSEDOWN6_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1105971;
pub const KEYC_MOUSEDOWN6_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1105970;
pub const KEYC_MOUSEDOWN6_SCROLLBAR_UP: C2RustUnnamed_35 = 1105969;
pub const KEYC_MOUSEDOWN6_STATUS_DEFAULT: C2RustUnnamed_35 = 1105968;
pub const KEYC_MOUSEDOWN6_STATUS_RIGHT: C2RustUnnamed_35 = 1105967;
pub const KEYC_MOUSEDOWN6_STATUS_LEFT: C2RustUnnamed_35 = 1105966;
pub const KEYC_MOUSEDOWN6_STATUS: C2RustUnnamed_35 = 1105965;
pub const KEYC_MOUSEDOWN6_PANE: C2RustUnnamed_35 = 1105964;
pub const KEYC_MOUSEDOWN3_BORDER: C2RustUnnamed_35 = 1105963;
pub const KEYC_MOUSEDOWN3_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1105962;
pub const KEYC_MOUSEDOWN3_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1105961;
pub const KEYC_MOUSEDOWN3_SCROLLBAR_UP: C2RustUnnamed_35 = 1105960;
pub const KEYC_MOUSEDOWN3_STATUS_DEFAULT: C2RustUnnamed_35 = 1105959;
pub const KEYC_MOUSEDOWN3_STATUS_RIGHT: C2RustUnnamed_35 = 1105958;
pub const KEYC_MOUSEDOWN3_STATUS_LEFT: C2RustUnnamed_35 = 1105957;
pub const KEYC_MOUSEDOWN3_STATUS: C2RustUnnamed_35 = 1105956;
pub const KEYC_MOUSEDOWN3_PANE: C2RustUnnamed_35 = 1105955;
pub const KEYC_MOUSEDOWN2_BORDER: C2RustUnnamed_35 = 1105954;
pub const KEYC_MOUSEDOWN2_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1105953;
pub const KEYC_MOUSEDOWN2_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1105952;
pub const KEYC_MOUSEDOWN2_SCROLLBAR_UP: C2RustUnnamed_35 = 1105951;
pub const KEYC_MOUSEDOWN2_STATUS_DEFAULT: C2RustUnnamed_35 = 1105950;
pub const KEYC_MOUSEDOWN2_STATUS_RIGHT: C2RustUnnamed_35 = 1105949;
pub const KEYC_MOUSEDOWN2_STATUS_LEFT: C2RustUnnamed_35 = 1105948;
pub const KEYC_MOUSEDOWN2_STATUS: C2RustUnnamed_35 = 1105947;
pub const KEYC_MOUSEDOWN2_PANE: C2RustUnnamed_35 = 1105946;
pub const KEYC_MOUSEDOWN1_BORDER: C2RustUnnamed_35 = 1105945;
pub const KEYC_MOUSEDOWN1_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1105944;
pub const KEYC_MOUSEDOWN1_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1105943;
pub const KEYC_MOUSEDOWN1_SCROLLBAR_UP: C2RustUnnamed_35 = 1105942;
pub const KEYC_MOUSEDOWN1_STATUS_DEFAULT: C2RustUnnamed_35 = 1105941;
pub const KEYC_MOUSEDOWN1_STATUS_RIGHT: C2RustUnnamed_35 = 1105940;
pub const KEYC_MOUSEDOWN1_STATUS_LEFT: C2RustUnnamed_35 = 1105939;
pub const KEYC_MOUSEDOWN1_STATUS: C2RustUnnamed_35 = 1105938;
pub const KEYC_MOUSEDOWN1_PANE: C2RustUnnamed_35 = 1105937;
pub const KEYC_MOUSEMOVE_BORDER: C2RustUnnamed_35 = 1105936;
pub const KEYC_MOUSEMOVE_SCROLLBAR_DOWN: C2RustUnnamed_35 = 1105935;
pub const KEYC_MOUSEMOVE_SCROLLBAR_SLIDER: C2RustUnnamed_35 = 1105934;
pub const KEYC_MOUSEMOVE_SCROLLBAR_UP: C2RustUnnamed_35 = 1105933;
pub const KEYC_MOUSEMOVE_STATUS_DEFAULT: C2RustUnnamed_35 = 1105932;
pub const KEYC_MOUSEMOVE_STATUS_RIGHT: C2RustUnnamed_35 = 1105931;
pub const KEYC_MOUSEMOVE_STATUS_LEFT: C2RustUnnamed_35 = 1105930;
pub const KEYC_MOUSEMOVE_STATUS: C2RustUnnamed_35 = 1105929;
pub const KEYC_MOUSEMOVE_PANE: C2RustUnnamed_35 = 1105928;
pub const KEYC_DOUBLECLICK: C2RustUnnamed_35 = 1105927;
pub const KEYC_DRAGGING: C2RustUnnamed_35 = 1105926;
pub const KEYC_MOUSE: C2RustUnnamed_35 = 1105925;
pub const KEYC_PASTE_END: C2RustUnnamed_35 = 1105924;
pub const KEYC_PASTE_START: C2RustUnnamed_35 = 1105923;
pub const KEYC_ANY: C2RustUnnamed_35 = 1105922;
pub const KEYC_FOCUS_OUT: C2RustUnnamed_35 = 1105921;
pub const KEYC_FOCUS_IN: C2RustUnnamed_35 = 1105920;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct window_pane_tree {
    pub rbh_root: *mut window_pane,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct windows {
    pub rbh_root: *mut window,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct environ_entry {
    pub name: *mut libc::c_char,
    pub value: *mut libc::c_char,
    pub flags: libc::c_int,
    pub entry: C2RustUnnamed_36,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_36 {
    pub rbe_left: *mut environ_entry,
    pub rbe_right: *mut environ_entry,
    pub rbe_parent: *mut environ_entry,
    pub rbe_color: libc::c_int,
}
pub type args_type = libc::c_uint;
pub const ARGS_COMMANDS: args_type = 2;
pub const ARGS_STRING: args_type = 1;
pub const ARGS_NONE: args_type = 0;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct args_value {
    pub type_0: args_type,
    pub c2rust_unnamed: C2RustUnnamed_38,
    pub cached: *mut libc::c_char,
    pub entry: C2RustUnnamed_37,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct C2RustUnnamed_37 {
    pub tqe_next: *mut args_value,
    pub tqe_prev: *mut *mut args_value,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union C2RustUnnamed_38 {
    pub string: *mut libc::c_char,
    pub cmdlist: *mut cmd_list,
}
pub type cmd_retval = libc::c_int;
pub const CMD_RETURN_STOP: cmd_retval = 2;
pub const CMD_RETURN_WAIT: cmd_retval = 1;
pub const CMD_RETURN_NORMAL: cmd_retval = 0;
pub const CMD_RETURN_ERROR: cmd_retval = -1;
pub type cmd_parse_status = libc::c_uint;
pub const CMD_PARSE_SUCCESS: cmd_parse_status = 1;
pub const CMD_PARSE_ERROR: cmd_parse_status = 0;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_parse_result {
    pub status: cmd_parse_status,
    pub cmdlist: *mut cmd_list,
    pub error: *mut libc::c_char,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub struct cmd_parse_input {
    pub flags: libc::c_int,
    pub file: *const libc::c_char,
    pub line: u_int,
    pub item: *mut cmdq_item,
    pub c: *mut client,
    pub fs: cmd_find_state,
}
pub type cmdq_cb = Option<unsafe extern "C" fn(*mut cmdq_item, *mut libc::c_void) -> cmd_retval>;
#[derive(Copy, Clone)]
#[repr(C)]
pub struct clients {
    pub tqh_first: *mut client,
    pub tqh_last: *mut *mut client,
}
pub const BORDER: C2RustUnnamed_39 = 6;
pub type C2RustUnnamed_39 = libc::c_uint;
pub const SCROLLBAR_DOWN: C2RustUnnamed_39 = 9;
pub const SCROLLBAR_SLIDER: C2RustUnnamed_39 = 8;
pub const SCROLLBAR_UP: C2RustUnnamed_39 = 7;
pub const STATUS_DEFAULT: C2RustUnnamed_39 = 5;
pub const STATUS_RIGHT: C2RustUnnamed_39 = 4;
pub const STATUS_LEFT: C2RustUnnamed_39 = 3;
pub const STATUS: C2RustUnnamed_39 = 2;
pub const PANE: C2RustUnnamed_39 = 1;
pub const NOWHERE: C2RustUnnamed_39 = 0;
pub const TRIPLE: C2RustUnnamed_40 = 8;
pub const DOUBLE: C2RustUnnamed_40 = 7;
pub const SECOND: C2RustUnnamed_40 = 6;
pub const DOWN: C2RustUnnamed_40 = 2;
pub const UP: C2RustUnnamed_40 = 3;
pub const WHEEL: C2RustUnnamed_40 = 5;
pub const DRAG: C2RustUnnamed_40 = 4;
pub const MOVE: C2RustUnnamed_40 = 1;
pub const NOTYPE: C2RustUnnamed_40 = 0;
pub type C2RustUnnamed_40 = libc::c_uint;
unsafe extern "C" fn server_client_window_cmp(
    mut cw1: *mut client_window,
    mut cw2: *mut client_window,
) -> libc::c_int {
    if (*cw1).window < (*cw2).window {
        return -(1 as libc::c_int);
    }
    if (*cw1).window > (*cw2).window {
        return 1 as libc::c_int;
    }
    return 0 as libc::c_int;
}
#[no_mangle]
pub unsafe extern "C" fn client_windows_RB_NFIND(
    mut head: *mut client_windows,
    mut elm: *mut client_window,
) -> *mut client_window {
    let mut tmp: *mut client_window = (*head).rbh_root;
    let mut res: *mut client_window = std::ptr::null_mut::<client_window>();
    let mut comp: libc::c_int = 0;
    while !tmp.is_null() {
        comp = server_client_window_cmp(elm, tmp);
        if comp < 0 as libc::c_int {
            res = tmp;
            tmp = (*tmp).entry.rbe_left;
        } else if comp > 0 as libc::c_int {
            tmp = (*tmp).entry.rbe_right;
        } else {
            return tmp;
        }
    }
    return res;
}
#[no_mangle]
pub unsafe extern "C" fn client_windows_RB_MINMAX(
    mut head: *mut client_windows,
    mut val: libc::c_int,
) -> *mut client_window {
    let mut tmp: *mut client_window = (*head).rbh_root;
    let mut parent: *mut client_window = std::ptr::null_mut::<client_window>();
    while !tmp.is_null() {
        parent = tmp;
        if val < 0 as libc::c_int {
            tmp = (*tmp).entry.rbe_left;
        } else {
            tmp = (*tmp).entry.rbe_right;
        }
    }
    return parent;
}
#[no_mangle]
pub unsafe extern "C" fn client_windows_RB_PREV(mut elm: *mut client_window) -> *mut client_window {
    if !((*elm).entry.rbe_left).is_null() {
        elm = (*elm).entry.rbe_left;
        while !((*elm).entry.rbe_right).is_null() {
            elm = (*elm).entry.rbe_right;
        }
    } else if !((*elm).entry.rbe_parent).is_null()
        && elm == (*(*elm).entry.rbe_parent).entry.rbe_right
    {
        elm = (*elm).entry.rbe_parent;
    } else {
        while !((*elm).entry.rbe_parent).is_null()
            && elm == (*(*elm).entry.rbe_parent).entry.rbe_left
        {
            elm = (*elm).entry.rbe_parent;
        }
        elm = (*elm).entry.rbe_parent;
    }
    return elm;
}
#[no_mangle]
pub unsafe extern "C" fn client_windows_RB_NEXT(mut elm: *mut client_window) -> *mut client_window {
    if !((*elm).entry.rbe_right).is_null() {
        elm = (*elm).entry.rbe_right;
        while !((*elm).entry.rbe_left).is_null() {
            elm = (*elm).entry.rbe_left;
        }
    } else if !((*elm).entry.rbe_parent).is_null()
        && elm == (*(*elm).entry.rbe_parent).entry.rbe_left
    {
        elm = (*elm).entry.rbe_parent;
    } else {
        while !((*elm).entry.rbe_parent).is_null()
            && elm == (*(*elm).entry.rbe_parent).entry.rbe_right
        {
            elm = (*elm).entry.rbe_parent;
        }
        elm = (*elm).entry.rbe_parent;
    }
    return elm;
}
#[no_mangle]
pub unsafe extern "C" fn client_windows_RB_FIND(
    mut head: *mut client_windows,
    mut elm: *mut client_window,
) -> *mut client_window {
    let mut tmp: *mut client_window = (*head).rbh_root;
    let mut comp: libc::c_int = 0;
    while !tmp.is_null() {
        comp = server_client_window_cmp(elm, tmp);
        if comp < 0 as libc::c_int {
            tmp = (*tmp).entry.rbe_left;
        } else if comp > 0 as libc::c_int {
            tmp = (*tmp).entry.rbe_right;
        } else {
            return tmp;
        }
    }
    return std::ptr::null_mut::<client_window>();
}
#[no_mangle]
pub unsafe extern "C" fn client_windows_RB_INSERT(
    mut head: *mut client_windows,
    mut elm: *mut client_window,
) -> *mut client_window {
    let mut tmp: *mut client_window = std::ptr::null_mut::<client_window>();
    let mut parent: *mut client_window = std::ptr::null_mut::<client_window>();
    let mut comp: libc::c_int = 0 as libc::c_int;
    tmp = (*head).rbh_root;
    while !tmp.is_null() {
        parent = tmp;
        comp = server_client_window_cmp(elm, parent);
        if comp < 0 as libc::c_int {
            tmp = (*tmp).entry.rbe_left;
        } else if comp > 0 as libc::c_int {
            tmp = (*tmp).entry.rbe_right;
        } else {
            return tmp;
        }
    }
    (*elm).entry.rbe_parent = parent;
    (*elm).entry.rbe_right = std::ptr::null_mut::<client_window>();
    (*elm).entry.rbe_left = (*elm).entry.rbe_right;
    (*elm).entry.rbe_color = 1 as libc::c_int;
    if !parent.is_null() {
        if comp < 0 as libc::c_int {
            (*parent).entry.rbe_left = elm;
        } else {
            (*parent).entry.rbe_right = elm;
        }
    } else {
        (*head).rbh_root = elm;
    }
    client_windows_RB_INSERT_COLOR(head, elm);
    return std::ptr::null_mut::<client_window>();
}
#[no_mangle]
pub unsafe extern "C" fn client_windows_RB_REMOVE(
    mut head: *mut client_windows,
    mut elm: *mut client_window,
) -> *mut client_window {
    let mut current_block: u64;
    let mut child: *mut client_window = std::ptr::null_mut::<client_window>();
    let mut parent: *mut client_window = std::ptr::null_mut::<client_window>();
    let mut old: *mut client_window = elm;
    let mut color: libc::c_int = 0;
    if ((*elm).entry.rbe_left).is_null() {
        child = (*elm).entry.rbe_right;
        current_block = 7245201122033322888;
    } else if ((*elm).entry.rbe_right).is_null() {
        child = (*elm).entry.rbe_left;
        current_block = 7245201122033322888;
    } else {
        let mut left: *mut client_window = std::ptr::null_mut::<client_window>();
        elm = (*elm).entry.rbe_right;
        loop {
            left = (*elm).entry.rbe_left;
            if left.is_null() {
                break;
            }
            elm = left;
        }
        child = (*elm).entry.rbe_right;
        parent = (*elm).entry.rbe_parent;
        color = (*elm).entry.rbe_color;
        if !child.is_null() {
            (*child).entry.rbe_parent = parent;
        }
        if !parent.is_null() {
            if (*parent).entry.rbe_left == elm {
                (*parent).entry.rbe_left = child;
            } else {
                (*parent).entry.rbe_right = child;
            }
        } else {
            (*head).rbh_root = child;
        }
        if (*elm).entry.rbe_parent == old {
            parent = elm;
        }
        (*elm).entry = (*old).entry;
        if !((*old).entry.rbe_parent).is_null() {
            if (*(*old).entry.rbe_parent).entry.rbe_left == old {
                (*(*old).entry.rbe_parent).entry.rbe_left = elm;
            } else {
                (*(*old).entry.rbe_parent).entry.rbe_right = elm;
            }
        } else {
            (*head).rbh_root = elm;
        }
        (*(*old).entry.rbe_left).entry.rbe_parent = elm;
        if !((*old).entry.rbe_right).is_null() {
            (*(*old).entry.rbe_right).entry.rbe_parent = elm;
        }
        if !parent.is_null() {
            left = parent;
            loop {
                left = (*left).entry.rbe_parent;
                if left.is_null() {
                    break;
                }
            }
        }
        current_block = 3150723483561758774;
    }
    match current_block {
        7245201122033322888 => {
            parent = (*elm).entry.rbe_parent;
            color = (*elm).entry.rbe_color;
            if !child.is_null() {
                (*child).entry.rbe_parent = parent;
            }
            if !parent.is_null() {
                if (*parent).entry.rbe_left == elm {
                    (*parent).entry.rbe_left = child;
                } else {
                    (*parent).entry.rbe_right = child;
                }
            } else {
                (*head).rbh_root = child;
            }
        }
        _ => {}
    }
    if color == 0 as libc::c_int {
        client_windows_RB_REMOVE_COLOR(head, parent, child);
    }
    return old;
}
#[no_mangle]
pub unsafe extern "C" fn client_windows_RB_REMOVE_COLOR(
    mut head: *mut client_windows,
    mut parent: *mut client_window,
    mut elm: *mut client_window,
) {
    let mut tmp: *mut client_window = std::ptr::null_mut::<client_window>();
    while (elm.is_null() || (*elm).entry.rbe_color == 0 as libc::c_int) && elm != (*head).rbh_root {
        if (*parent).entry.rbe_left == elm {
            tmp = (*parent).entry.rbe_right;
            if (*tmp).entry.rbe_color == 1 as libc::c_int {
                (*tmp).entry.rbe_color = 0 as libc::c_int;
                (*parent).entry.rbe_color = 1 as libc::c_int;
                tmp = (*parent).entry.rbe_right;
                (*parent).entry.rbe_right = (*tmp).entry.rbe_left;
                if !((*parent).entry.rbe_right).is_null() {
                    (*(*tmp).entry.rbe_left).entry.rbe_parent = parent;
                }
                (*tmp).entry.rbe_parent = (*parent).entry.rbe_parent;
                if !((*tmp).entry.rbe_parent).is_null() {
                    if parent == (*(*parent).entry.rbe_parent).entry.rbe_left {
                        (*(*parent).entry.rbe_parent).entry.rbe_left = tmp;
                    } else {
                        (*(*parent).entry.rbe_parent).entry.rbe_right = tmp;
                    }
                } else {
                    (*head).rbh_root = tmp;
                }
                (*tmp).entry.rbe_left = parent;
                (*parent).entry.rbe_parent = tmp;
                !((*tmp).entry.rbe_parent).is_null();
                tmp = (*parent).entry.rbe_right;
            }
            if (((*tmp).entry.rbe_left).is_null()
                || (*(*tmp).entry.rbe_left).entry.rbe_color == 0 as libc::c_int)
                && (((*tmp).entry.rbe_right).is_null()
                    || (*(*tmp).entry.rbe_right).entry.rbe_color == 0 as libc::c_int)
            {
                (*tmp).entry.rbe_color = 1 as libc::c_int;
                elm = parent;
                parent = (*elm).entry.rbe_parent;
            } else {
                if ((*tmp).entry.rbe_right).is_null()
                    || (*(*tmp).entry.rbe_right).entry.rbe_color == 0 as libc::c_int
                {
                    let mut oleft: *mut client_window = std::ptr::null_mut::<client_window>();
                    oleft = (*tmp).entry.rbe_left;
                    if !oleft.is_null() {
                        (*oleft).entry.rbe_color = 0 as libc::c_int;
                    }
                    (*tmp).entry.rbe_color = 1 as libc::c_int;
                    oleft = (*tmp).entry.rbe_left;
                    (*tmp).entry.rbe_left = (*oleft).entry.rbe_right;
                    if !((*tmp).entry.rbe_left).is_null() {
                        (*(*oleft).entry.rbe_right).entry.rbe_parent = tmp;
                    }
                    (*oleft).entry.rbe_parent = (*tmp).entry.rbe_parent;
                    if !((*oleft).entry.rbe_parent).is_null() {
                        if tmp == (*(*tmp).entry.rbe_parent).entry.rbe_left {
                            (*(*tmp).entry.rbe_parent).entry.rbe_left = oleft;
                        } else {
                            (*(*tmp).entry.rbe_parent).entry.rbe_right = oleft;
                        }
                    } else {
                        (*head).rbh_root = oleft;
                    }
                    (*oleft).entry.rbe_right = tmp;
                    (*tmp).entry.rbe_parent = oleft;
                    !((*oleft).entry.rbe_parent).is_null();
                    tmp = (*parent).entry.rbe_right;
                }
                (*tmp).entry.rbe_color = (*parent).entry.rbe_color;
                (*parent).entry.rbe_color = 0 as libc::c_int;
                if !((*tmp).entry.rbe_right).is_null() {
                    (*(*tmp).entry.rbe_right).entry.rbe_color = 0 as libc::c_int;
                }
                tmp = (*parent).entry.rbe_right;
                (*parent).entry.rbe_right = (*tmp).entry.rbe_left;
                if !((*parent).entry.rbe_right).is_null() {
                    (*(*tmp).entry.rbe_left).entry.rbe_parent = parent;
                }
                (*tmp).entry.rbe_parent = (*parent).entry.rbe_parent;
                if !((*tmp).entry.rbe_parent).is_null() {
                    if parent == (*(*parent).entry.rbe_parent).entry.rbe_left {
                        (*(*parent).entry.rbe_parent).entry.rbe_left = tmp;
                    } else {
                        (*(*parent).entry.rbe_parent).entry.rbe_right = tmp;
                    }
                } else {
                    (*head).rbh_root = tmp;
                }
                (*tmp).entry.rbe_left = parent;
                (*parent).entry.rbe_parent = tmp;
                !((*tmp).entry.rbe_parent).is_null();
                elm = (*head).rbh_root;
                break;
            }
        } else {
            tmp = (*parent).entry.rbe_left;
            if (*tmp).entry.rbe_color == 1 as libc::c_int {
                (*tmp).entry.rbe_color = 0 as libc::c_int;
                (*parent).entry.rbe_color = 1 as libc::c_int;
                tmp = (*parent).entry.rbe_left;
                (*parent).entry.rbe_left = (*tmp).entry.rbe_right;
                if !((*parent).entry.rbe_left).is_null() {
                    (*(*tmp).entry.rbe_right).entry.rbe_parent = parent;
                }
                (*tmp).entry.rbe_parent = (*parent).entry.rbe_parent;
                if !((*tmp).entry.rbe_parent).is_null() {
                    if parent == (*(*parent).entry.rbe_parent).entry.rbe_left {
                        (*(*parent).entry.rbe_parent).entry.rbe_left = tmp;
                    } else {
                        (*(*parent).entry.rbe_parent).entry.rbe_right = tmp;
                    }
                } else {
                    (*head).rbh_root = tmp;
                }
                (*tmp).entry.rbe_right = parent;
                (*parent).entry.rbe_parent = tmp;
                !((*tmp).entry.rbe_parent).is_null();
                tmp = (*parent).entry.rbe_left;
            }
            if (((*tmp).entry.rbe_left).is_null()
                || (*(*tmp).entry.rbe_left).entry.rbe_color == 0 as libc::c_int)
                && (((*tmp).entry.rbe_right).is_null()
                    || (*(*tmp).entry.rbe_right).entry.rbe_color == 0 as libc::c_int)
            {
                (*tmp).entry.rbe_color = 1 as libc::c_int;
                elm = parent;
                parent = (*elm).entry.rbe_parent;
            } else {
                if ((*tmp).entry.rbe_left).is_null()
                    || (*(*tmp).entry.rbe_left).entry.rbe_color == 0 as libc::c_int
                {
                    let mut oright: *mut client_window = std::ptr::null_mut::<client_window>();
                    oright = (*tmp).entry.rbe_right;
                    if !oright.is_null() {
                        (*oright).entry.rbe_color = 0 as libc::c_int;
                    }
                    (*tmp).entry.rbe_color = 1 as libc::c_int;
                    oright = (*tmp).entry.rbe_right;
                    (*tmp).entry.rbe_right = (*oright).entry.rbe_left;
                    if !((*tmp).entry.rbe_right).is_null() {
                        (*(*oright).entry.rbe_left).entry.rbe_parent = tmp;
                    }
                    (*oright).entry.rbe_parent = (*tmp).entry.rbe_parent;
                    if !((*oright).entry.rbe_parent).is_null() {
                        if tmp == (*(*tmp).entry.rbe_parent).entry.rbe_left {
                            (*(*tmp).entry.rbe_parent).entry.rbe_left = oright;
                        } else {
                            (*(*tmp).entry.rbe_parent).entry.rbe_right = oright;
                        }
                    } else {
                        (*head).rbh_root = oright;
                    }
                    (*oright).entry.rbe_left = tmp;
                    (*tmp).entry.rbe_parent = oright;
                    !((*oright).entry.rbe_parent).is_null();
                    tmp = (*parent).entry.rbe_left;
                }
                (*tmp).entry.rbe_color = (*parent).entry.rbe_color;
                (*parent).entry.rbe_color = 0 as libc::c_int;
                if !((*tmp).entry.rbe_left).is_null() {
                    (*(*tmp).entry.rbe_left).entry.rbe_color = 0 as libc::c_int;
                }
                tmp = (*parent).entry.rbe_left;
                (*parent).entry.rbe_left = (*tmp).entry.rbe_right;
                if !((*parent).entry.rbe_left).is_null() {
                    (*(*tmp).entry.rbe_right).entry.rbe_parent = parent;
                }
                (*tmp).entry.rbe_parent = (*parent).entry.rbe_parent;
                if !((*tmp).entry.rbe_parent).is_null() {
                    if parent == (*(*parent).entry.rbe_parent).entry.rbe_left {
                        (*(*parent).entry.rbe_parent).entry.rbe_left = tmp;
                    } else {
                        (*(*parent).entry.rbe_parent).entry.rbe_right = tmp;
                    }
                } else {
                    (*head).rbh_root = tmp;
                }
                (*tmp).entry.rbe_right = parent;
                (*parent).entry.rbe_parent = tmp;
                !((*tmp).entry.rbe_parent).is_null();
                elm = (*head).rbh_root;
                break;
            }
        }
    }
    if !elm.is_null() {
        (*elm).entry.rbe_color = 0 as libc::c_int;
    }
}
#[no_mangle]
pub unsafe extern "C" fn client_windows_RB_INSERT_COLOR(
    mut head: *mut client_windows,
    mut elm: *mut client_window,
) {
    let mut parent: *mut client_window = std::ptr::null_mut::<client_window>();
    let mut gparent: *mut client_window = std::ptr::null_mut::<client_window>();
    let mut tmp: *mut client_window = std::ptr::null_mut::<client_window>();
    loop {
        parent = (*elm).entry.rbe_parent;
        if parent.is_null() || (*parent).entry.rbe_color != 1 as libc::c_int {
            break;
        }
        gparent = (*parent).entry.rbe_parent;
        if parent == (*gparent).entry.rbe_left {
            tmp = (*gparent).entry.rbe_right;
            if !tmp.is_null() && (*tmp).entry.rbe_color == 1 as libc::c_int {
                (*tmp).entry.rbe_color = 0 as libc::c_int;
                (*parent).entry.rbe_color = 0 as libc::c_int;
                (*gparent).entry.rbe_color = 1 as libc::c_int;
                elm = gparent;
            } else {
                if (*parent).entry.rbe_right == elm {
                    tmp = (*parent).entry.rbe_right;
                    (*parent).entry.rbe_right = (*tmp).entry.rbe_left;
                    if !((*parent).entry.rbe_right).is_null() {
                        (*(*tmp).entry.rbe_left).entry.rbe_parent = parent;
                    }
                    (*tmp).entry.rbe_parent = (*parent).entry.rbe_parent;
                    if !((*tmp).entry.rbe_parent).is_null() {
                        if parent == (*(*parent).entry.rbe_parent).entry.rbe_left {
                            (*(*parent).entry.rbe_parent).entry.rbe_left = tmp;
                        } else {
                            (*(*parent).entry.rbe_parent).entry.rbe_right = tmp;
                        }
                    } else {
                        (*head).rbh_root = tmp;
                    }
                    (*tmp).entry.rbe_left = parent;
                    (*parent).entry.rbe_parent = tmp;
                    !((*tmp).entry.rbe_parent).is_null();
                    tmp = parent;
                    parent = elm;
                    elm = tmp;
                }
                (*parent).entry.rbe_color = 0 as libc::c_int;
                (*gparent).entry.rbe_color = 1 as libc::c_int;
                tmp = (*gparent).entry.rbe_left;
                (*gparent).entry.rbe_left = (*tmp).entry.rbe_right;
                if !((*gparent).entry.rbe_left).is_null() {
                    (*(*tmp).entry.rbe_right).entry.rbe_parent = gparent;
                }
                (*tmp).entry.rbe_parent = (*gparent).entry.rbe_parent;
                if !((*tmp).entry.rbe_parent).is_null() {
                    if gparent == (*(*gparent).entry.rbe_parent).entry.rbe_left {
                        (*(*gparent).entry.rbe_parent).entry.rbe_left = tmp;
                    } else {
                        (*(*gparent).entry.rbe_parent).entry.rbe_right = tmp;
                    }
                } else {
                    (*head).rbh_root = tmp;
                }
                (*tmp).entry.rbe_right = gparent;
                (*gparent).entry.rbe_parent = tmp;
                !((*tmp).entry.rbe_parent).is_null();
            }
        } else {
            tmp = (*gparent).entry.rbe_left;
            if !tmp.is_null() && (*tmp).entry.rbe_color == 1 as libc::c_int {
                (*tmp).entry.rbe_color = 0 as libc::c_int;
                (*parent).entry.rbe_color = 0 as libc::c_int;
                (*gparent).entry.rbe_color = 1 as libc::c_int;
                elm = gparent;
            } else {
                if (*parent).entry.rbe_left == elm {
                    tmp = (*parent).entry.rbe_left;
                    (*parent).entry.rbe_left = (*tmp).entry.rbe_right;
                    if !((*parent).entry.rbe_left).is_null() {
                        (*(*tmp).entry.rbe_right).entry.rbe_parent = parent;
                    }
                    (*tmp).entry.rbe_parent = (*parent).entry.rbe_parent;
                    if !((*tmp).entry.rbe_parent).is_null() {
                        if parent == (*(*parent).entry.rbe_parent).entry.rbe_left {
                            (*(*parent).entry.rbe_parent).entry.rbe_left = tmp;
                        } else {
                            (*(*parent).entry.rbe_parent).entry.rbe_right = tmp;
                        }
                    } else {
                        (*head).rbh_root = tmp;
                    }
                    (*tmp).entry.rbe_right = parent;
                    (*parent).entry.rbe_parent = tmp;
                    !((*tmp).entry.rbe_parent).is_null();
                    tmp = parent;
                    parent = elm;
                    elm = tmp;
                }
                (*parent).entry.rbe_color = 0 as libc::c_int;
                (*gparent).entry.rbe_color = 1 as libc::c_int;
                tmp = (*gparent).entry.rbe_right;
                (*gparent).entry.rbe_right = (*tmp).entry.rbe_left;
                if !((*gparent).entry.rbe_right).is_null() {
                    (*(*tmp).entry.rbe_left).entry.rbe_parent = gparent;
                }
                (*tmp).entry.rbe_parent = (*gparent).entry.rbe_parent;
                if !((*tmp).entry.rbe_parent).is_null() {
                    if gparent == (*(*gparent).entry.rbe_parent).entry.rbe_left {
                        (*(*gparent).entry.rbe_parent).entry.rbe_left = tmp;
                    } else {
                        (*(*gparent).entry.rbe_parent).entry.rbe_right = tmp;
                    }
                } else {
                    (*head).rbh_root = tmp;
                }
                (*tmp).entry.rbe_left = gparent;
                (*gparent).entry.rbe_parent = tmp;
                !((*tmp).entry.rbe_parent).is_null();
            }
        }
    }
    (*(*head).rbh_root).entry.rbe_color = 0 as libc::c_int;
}
#[no_mangle]
pub unsafe extern "C" fn server_client_how_many() -> u_int {
    let mut c: *mut client = std::ptr::null_mut::<client>();
    let mut n: u_int = 0;
    n = 0 as libc::c_int as u_int;
    c = clients.tqh_first;
    while !c.is_null() {
        if !((*c).session).is_null()
            && !(*c).flags
                & (0x200 as libc::c_int | 0x40 as libc::c_int | 0x4 as libc::c_int) as libc::c_ulong
                != 0
        {
            n = n.wrapping_add(1);
        }
        c = (*c).entry.tqe_next;
    }
    return n;
}
unsafe extern "C" fn server_client_overlay_timer(
    mut fd: libc::c_int,
    mut events: libc::c_short,
    mut data: *mut libc::c_void,
) {
    server_client_clear_overlay(data as *mut client);
}
#[no_mangle]
pub unsafe extern "C" fn server_client_set_overlay(
    mut c: *mut client,
    mut delay: u_int,
    mut checkcb: overlay_check_cb,
    mut modecb: overlay_mode_cb,
    mut drawcb: overlay_draw_cb,
    mut keycb: overlay_key_cb,
    mut freecb: overlay_free_cb,
    mut resizecb: overlay_resize_cb,
    mut data: *mut libc::c_void,
) {
    let mut tv: timeval = timeval {
        tv_sec: 0,
        tv_usec: 0,
    };
    if ((*c).overlay_draw).is_some() {
        server_client_clear_overlay(c);
    }
    tv.tv_sec = delay.wrapping_div(1000 as libc::c_int as libc::c_uint) as __time_t;
    tv.tv_usec = delay.wrapping_rem(1000 as libc::c_int as libc::c_uint) as libc::c_long
        * 1000 as libc::c_long;
    if event_initialized(&mut (*c).overlay_timer) != 0 {
        event_del(&mut (*c).overlay_timer);
    }
    event_set(
        &mut (*c).overlay_timer,
        -(1 as libc::c_int),
        0 as libc::c_int as libc::c_short,
        Some(
            server_client_overlay_timer
                as unsafe extern "C" fn(libc::c_int, libc::c_short, *mut libc::c_void) -> (),
        ),
        c as *mut libc::c_void,
    );
    if delay != 0 as libc::c_int as libc::c_uint {
        event_add(&mut (*c).overlay_timer, &mut tv);
    }
    (*c).overlay_check = checkcb;
    (*c).overlay_mode = modecb;
    (*c).overlay_draw = drawcb;
    (*c).overlay_key = keycb;
    (*c).overlay_free = freecb;
    (*c).overlay_resize = resizecb;
    (*c).overlay_data = data;
    if ((*c).overlay_check).is_none() {
        (*c).tty.flags |= 0x2 as libc::c_int;
    }
    if ((*c).overlay_mode).is_none() {
        (*c).tty.flags |= 0x1 as libc::c_int;
    }
    window_update_focus((*(*(*c).session).curw).window);
    server_redraw_client(c);
}
#[no_mangle]
pub unsafe extern "C" fn server_client_clear_overlay(mut c: *mut client) {
    if ((*c).overlay_draw).is_none() {
        return;
    }
    if event_initialized(&mut (*c).overlay_timer) != 0 {
        event_del(&mut (*c).overlay_timer);
    }
    if ((*c).overlay_free).is_some() {
        ((*c).overlay_free).expect("non-null function pointer")(c, (*c).overlay_data);
    }
    (*c).overlay_check = None;
    (*c).overlay_mode = None;
    (*c).overlay_draw = None;
    (*c).overlay_key = None;
    (*c).overlay_free = None;
    (*c).overlay_data = std::ptr::null_mut::<libc::c_void>();
    (*c).tty.flags &= !(0x2 as libc::c_int | 0x1 as libc::c_int);
    window_update_focus((*(*(*c).session).curw).window);
    server_redraw_client(c);
}
#[no_mangle]
pub unsafe extern "C" fn server_client_overlay_range(
    mut x: u_int,
    mut y: u_int,
    mut sx: u_int,
    mut sy: u_int,
    mut px: u_int,
    mut py: u_int,
    mut nx: u_int,
    mut r: *mut overlay_ranges,
) {
    let mut ox: u_int = 0;
    let mut onx: u_int = 0;
    (*r).px[2 as libc::c_int as usize] = 0 as libc::c_int as u_int;
    (*r).nx[2 as libc::c_int as usize] = 0 as libc::c_int as u_int;
    if py < y
        || py
            > y.wrapping_add(sy)
                .wrapping_sub(1 as libc::c_int as libc::c_uint)
    {
        (*r).px[0 as libc::c_int as usize] = px;
        (*r).nx[0 as libc::c_int as usize] = nx;
        (*r).px[1 as libc::c_int as usize] = 0 as libc::c_int as u_int;
        (*r).nx[1 as libc::c_int as usize] = 0 as libc::c_int as u_int;
        return;
    }
    if px < x {
        (*r).px[0 as libc::c_int as usize] = px;
        (*r).nx[0 as libc::c_int as usize] = x.wrapping_sub(px);
        if (*r).nx[0 as libc::c_int as usize] > nx {
            (*r).nx[0 as libc::c_int as usize] = nx;
        }
    } else {
        (*r).px[0 as libc::c_int as usize] = 0 as libc::c_int as u_int;
        (*r).nx[0 as libc::c_int as usize] = 0 as libc::c_int as u_int;
    }
    ox = x.wrapping_add(sx);
    if px > ox {
        ox = px;
    }
    onx = px.wrapping_add(nx);
    if onx > ox {
        (*r).px[1 as libc::c_int as usize] = ox;
        (*r).nx[1 as libc::c_int as usize] = onx.wrapping_sub(ox);
    } else {
        (*r).px[1 as libc::c_int as usize] = 0 as libc::c_int as u_int;
        (*r).nx[1 as libc::c_int as usize] = 0 as libc::c_int as u_int;
    };
}
#[no_mangle]
pub unsafe extern "C" fn server_client_check_nested(mut c: *mut client) -> libc::c_int {
    let mut envent: *mut environ_entry = std::ptr::null_mut::<environ_entry>();
    let mut wp: *mut window_pane = std::ptr::null_mut::<window_pane>();
    envent = environ_find((*c).environ, b"TMUX\0" as *const u8 as *const libc::c_char);
    if envent.is_null() || *(*envent).value as libc::c_int == '\0' as i32 {
        return 0 as libc::c_int;
    }
    wp = window_pane_tree_RB_MINMAX(&mut all_window_panes, -(1 as libc::c_int));
    while !wp.is_null() {
        if strcmp(((*wp).tty).as_mut_ptr(), (*c).ttyname) == 0 as libc::c_int {
            return 1 as libc::c_int;
        }
        wp = window_pane_tree_RB_NEXT(wp);
    }
    return 0 as libc::c_int;
}
#[no_mangle]
pub unsafe extern "C" fn server_client_set_key_table(
    mut c: *mut client,
    mut name: *const libc::c_char,
) {
    if name.is_null() {
        name = server_client_get_key_table(c);
    }
    key_bindings_unref_table((*c).keytable);
    (*c).keytable = key_bindings_get_table(name, 1 as libc::c_int);
    (*(*c).keytable).references = ((*(*c).keytable).references).wrapping_add(1);
    if gettimeofday(
        &mut (*(*c).keytable).activity_time,
        std::ptr::null_mut::<libc::c_void>(),
    ) != 0 as libc::c_int
    {
        fatal(b"gettimeofday failed\0" as *const u8 as *const libc::c_char);
    }
}
unsafe extern "C" fn server_client_key_table_activity_diff(mut c: *mut client) -> uint64_t {
    let mut diff: timeval = timeval {
        tv_sec: 0,
        tv_usec: 0,
    };
    diff.tv_sec = (*c).activity_time.tv_sec - (*(*c).keytable).activity_time.tv_sec;
    diff.tv_usec = (*c).activity_time.tv_usec - (*(*c).keytable).activity_time.tv_usec;
    if diff.tv_usec < 0 as libc::c_int as libc::c_long {
        diff.tv_sec -= 1;
        diff.tv_usec += 1000000 as libc::c_int as libc::c_long;
    }
    return (diff.tv_sec as libc::c_ulonglong)
        .wrapping_mul(1000 as libc::c_ulonglong)
        .wrapping_add((diff.tv_usec as libc::c_ulonglong).wrapping_div(1000 as libc::c_ulonglong))
        as uint64_t;
}
#[no_mangle]
pub unsafe extern "C" fn server_client_get_key_table(mut c: *mut client) -> *const libc::c_char {
    let mut s: *mut session = (*c).session;
    let mut name: *const libc::c_char = std::ptr::null::<libc::c_char>();
    if s.is_null() {
        return b"root\0" as *const u8 as *const libc::c_char;
    }
    name = options_get_string(
        (*s).options,
        b"key-table\0" as *const u8 as *const libc::c_char,
    );
    if *name as libc::c_int == '\0' as i32 {
        return b"root\0" as *const u8 as *const libc::c_char;
    }
    return name;
}
unsafe extern "C" fn server_client_is_default_key_table(
    mut c: *mut client,
    mut table: *mut key_table,
) -> libc::c_int {
    return (strcmp((*table).name, server_client_get_key_table(c)) == 0 as libc::c_int)
        as libc::c_int;
}
#[no_mangle]
pub unsafe extern "C" fn server_client_create(mut fd: libc::c_int) -> *mut client {
    let mut c: *mut client = std::ptr::null_mut::<client>();
    setblocking(fd, 0 as libc::c_int);
    c = xcalloc(
        1 as libc::c_int as size_t,
        ::core::mem::size_of::<client>() as libc::c_ulong,
    ) as *mut client;
    (*c).references = 1 as libc::c_int;
    (*c).peer = proc_add_peer(
        server_proc,
        fd,
        Some(server_client_dispatch as unsafe extern "C" fn(*mut imsg, *mut libc::c_void) -> ()),
        c as *mut libc::c_void,
    );
    if gettimeofday(
        &mut (*c).creation_time,
        std::ptr::null_mut::<libc::c_void>(),
    ) != 0 as libc::c_int
    {
        fatal(b"gettimeofday failed\0" as *const u8 as *const libc::c_char);
    }
    memcpy(
        &mut (*c).activity_time as *mut timeval as *mut libc::c_void,
        &mut (*c).creation_time as *mut timeval as *const libc::c_void,
        ::core::mem::size_of::<timeval>() as libc::c_ulong,
    );
    (*c).environ = environ_create();
    (*c).fd = -(1 as libc::c_int);
    (*c).out_fd = -(1 as libc::c_int);
    (*c).queue = cmdq_new();
    (*c).windows.rbh_root = std::ptr::null_mut::<client_window>();
    (*c).files.rbh_root = std::ptr::null_mut::<client_file>();
    (*c).tty.sx = 80 as libc::c_int as u_int;
    (*c).tty.sy = 24 as libc::c_int as u_int;
    status_init(c);
    (*c).flags |= 0x8000 as libc::c_int as libc::c_ulong;
    (*c).keytable = key_bindings_get_table(
        b"root\0" as *const u8 as *const libc::c_char,
        1 as libc::c_int,
    );
    (*(*c).keytable).references = ((*(*c).keytable).references).wrapping_add(1);
    event_set(
        &mut (*c).repeat_timer,
        -(1 as libc::c_int),
        0 as libc::c_int as libc::c_short,
        Some(
            server_client_repeat_timer
                as unsafe extern "C" fn(libc::c_int, libc::c_short, *mut libc::c_void) -> (),
        ),
        c as *mut libc::c_void,
    );
    event_set(
        &mut (*c).click_timer,
        -(1 as libc::c_int),
        0 as libc::c_int as libc::c_short,
        Some(
            server_client_click_timer
                as unsafe extern "C" fn(libc::c_int, libc::c_short, *mut libc::c_void) -> (),
        ),
        c as *mut libc::c_void,
    );
    (*c).entry.tqe_next = std::ptr::null_mut::<client>();
    (*c).entry.tqe_prev = clients.tqh_last;
    *clients.tqh_last = c;
    clients.tqh_last = &mut (*c).entry.tqe_next;
    log_debug(b"new client %p\0" as *const u8 as *const libc::c_char, c);
    return c;
}
#[no_mangle]
pub unsafe extern "C" fn server_client_open(
    mut c: *mut client,
    mut cause: *mut *mut libc::c_char,
) -> libc::c_int {
    let mut ttynam: *const libc::c_char = b"/dev/tty\0" as *const u8 as *const libc::c_char;
    if (*c).flags & 0x2000 as libc::c_int as libc::c_ulong != 0 {
        return 0 as libc::c_int;
    }
    if strcmp((*c).ttyname, ttynam) == 0 as libc::c_int
        || (isatty(0 as libc::c_int) != 0
            && {
                ttynam = ttyname(0 as libc::c_int);
                !ttynam.is_null()
            }
            && strcmp((*c).ttyname, ttynam) == 0 as libc::c_int
            || isatty(1 as libc::c_int) != 0
                && {
                    ttynam = ttyname(1 as libc::c_int);
                    !ttynam.is_null()
                }
                && strcmp((*c).ttyname, ttynam) == 0 as libc::c_int
            || isatty(2 as libc::c_int) != 0
                && {
                    ttynam = ttyname(2 as libc::c_int);
                    !ttynam.is_null()
                }
                && strcmp((*c).ttyname, ttynam) == 0 as libc::c_int)
    {
        xasprintf(
            cause,
            b"can't use %s\0" as *const u8 as *const libc::c_char,
            (*c).ttyname,
        );
        return -(1 as libc::c_int);
    }
    if (*c).flags & 0x1 as libc::c_int as libc::c_ulong == 0 {
        *cause = xstrdup(b"not a terminal\0" as *const u8 as *const libc::c_char);
        return -(1 as libc::c_int);
    }
    if tty_open(&mut (*c).tty, cause) != 0 as libc::c_int {
        return -(1 as libc::c_int);
    }
    return 0 as libc::c_int;
}
unsafe extern "C" fn server_client_attached_lost(mut c: *mut client) {
    let mut s: *mut session = std::ptr::null_mut::<session>();
    let mut w: *mut window = std::ptr::null_mut::<window>();
    let mut loop_0: *mut client = std::ptr::null_mut::<client>();
    let mut found: *mut client = std::ptr::null_mut::<client>();
    log_debug(
        b"lost attached client %p\0" as *const u8 as *const libc::c_char,
        c,
    );
    w = windows_RB_MINMAX(&mut windows, -(1 as libc::c_int));
    while !w.is_null() {
        if (*w).latest == c as *mut libc::c_void {
            found = std::ptr::null_mut::<client>();
            loop_0 = clients.tqh_first;
            while !loop_0.is_null() {
                s = (*loop_0).session;
                if !(loop_0 == c || s.is_null() || (*(*s).curw).window != w) {
                    if found.is_null()
                        || (if (*loop_0).activity_time.tv_sec == (*found).activity_time.tv_sec {
                            ((*loop_0).activity_time.tv_usec > (*found).activity_time.tv_usec)
                                as libc::c_int
                        } else {
                            ((*loop_0).activity_time.tv_sec > (*found).activity_time.tv_sec)
                                as libc::c_int
                        }) != 0
                    {
                        found = loop_0;
                    }
                }
                loop_0 = (*loop_0).entry.tqe_next;
            }
            if !found.is_null() {
                server_client_update_latest(found);
            }
        }
        w = windows_RB_NEXT(w);
    }
}
#[no_mangle]
pub unsafe extern "C" fn server_client_set_session(mut c: *mut client, mut s: *mut session) {
    let mut old: *mut session = (*c).session;
    if !s.is_null() && !((*c).session).is_null() && (*c).session != s {
        (*c).last_session = (*c).session;
    } else if s.is_null() {
        (*c).last_session = std::ptr::null_mut::<session>();
    }
    (*c).session = s;
    (*c).flags |= 0x8000 as libc::c_int as libc::c_ulong;
    if !old.is_null() && !((*old).curw).is_null() {
        window_update_focus((*(*old).curw).window);
    }
    if !s.is_null() {
        recalculate_sizes();
        window_update_focus((*(*s).curw).window);
        session_update_activity(s, std::ptr::null_mut::<timeval>());
        gettimeofday(
            &mut (*s).last_attached_time,
            std::ptr::null_mut::<libc::c_void>(),
        );
        (*(*s).curw).flags &= !(0x1 as libc::c_int | 0x2 as libc::c_int | 0x4 as libc::c_int);
        (*(*(*s).curw).window).latest = c as *mut libc::c_void;
        alerts_check_session(s);
        tty_update_client_offset(c);
        status_timer_start(c);
        notify_client(
            b"client-session-changed\0" as *const u8 as *const libc::c_char,
            c,
        );
        server_redraw_client(c);
    }
    server_check_unattached();
    server_update_socket();
}
#[no_mangle]
pub unsafe extern "C" fn server_client_lost(mut c: *mut client) {
    let mut cf: *mut client_file = std::ptr::null_mut::<client_file>();
    let mut cf1: *mut client_file = std::ptr::null_mut::<client_file>();
    let mut cw: *mut client_window = std::ptr::null_mut::<client_window>();
    let mut cw1: *mut client_window = std::ptr::null_mut::<client_window>();
    (*c).flags |= 0x200 as libc::c_int as libc::c_ulong;
    server_client_clear_overlay(c);
    status_prompt_clear(c);
    status_message_clear(c);
    cf = client_files_RB_MINMAX(&mut (*c).files, -(1 as libc::c_int));
    while !cf.is_null() && {
        cf1 = client_files_RB_NEXT(cf);
        1 as libc::c_int != 0
    } {
        (*cf).error = 4 as libc::c_int;
        file_fire_done(cf);
        cf = cf1;
    }
    cw = client_windows_RB_MINMAX(&mut (*c).windows, -(1 as libc::c_int));
    while !cw.is_null() && {
        cw1 = client_windows_RB_NEXT(cw);
        1 as libc::c_int != 0
    } {
        client_windows_RB_REMOVE(&mut (*c).windows, cw);
        free(cw as *mut libc::c_void);
        cw = cw1;
    }
    if !((*c).entry.tqe_next).is_null() {
        (*(*c).entry.tqe_next).entry.tqe_prev = (*c).entry.tqe_prev;
    } else {
        clients.tqh_last = (*c).entry.tqe_prev;
    }
    *(*c).entry.tqe_prev = (*c).entry.tqe_next;
    log_debug(b"lost client %p\0" as *const u8 as *const libc::c_char, c);
    if (*c).flags & 0x80 as libc::c_int as libc::c_ulong != 0 {
        server_client_attached_lost(c);
        notify_client(b"client-detached\0" as *const u8 as *const libc::c_char, c);
    }
    if (*c).flags & 0x2000 as libc::c_int as libc::c_ulong != 0 {
        control_stop(c);
    }
    if (*c).flags & 0x1 as libc::c_int as libc::c_ulong != 0 {
        tty_free(&mut (*c).tty);
    }
    free((*c).ttyname as *mut libc::c_void);
    free((*c).clipboard_panes as *mut libc::c_void);
    free((*c).term_name as *mut libc::c_void);
    free((*c).term_type as *mut libc::c_void);
    tty_term_free_list((*c).term_caps, (*c).term_ncaps);
    status_free(c);
    free((*c).title as *mut libc::c_void);
    free((*c).cwd as *mut libc::c_void);
    event_del(&mut (*c).repeat_timer);
    event_del(&mut (*c).click_timer);
    key_bindings_unref_table((*c).keytable);
    free((*c).message_string as *mut libc::c_void);
    if event_initialized(&mut (*c).message_timer) != 0 {
        event_del(&mut (*c).message_timer);
    }
    free((*c).prompt_saved as *mut libc::c_void);
    free((*c).prompt_string as *mut libc::c_void);
    free((*c).prompt_buffer as *mut libc::c_void);
    format_lost_client(c);
    environ_free((*c).environ);
    proc_remove_peer((*c).peer);
    (*c).peer = std::ptr::null_mut::<tmuxpeer>();
    if (*c).out_fd != -(1 as libc::c_int) {
        close((*c).out_fd);
    }
    if (*c).fd != -(1 as libc::c_int) {
        close((*c).fd);
        (*c).fd = -(1 as libc::c_int);
    }
    server_client_unref(c);
    server_add_accept(0 as libc::c_int);
    recalculate_sizes();
    server_check_unattached();
    server_update_socket();
}
#[no_mangle]
pub unsafe extern "C" fn server_client_unref(mut c: *mut client) {
    log_debug(
        b"unref client %p (%d references)\0" as *const u8 as *const libc::c_char,
        c,
        (*c).references,
    );
    (*c).references -= 1;
    if (*c).references == 0 as libc::c_int {
        event_once(
            -(1 as libc::c_int),
            0x1 as libc::c_int as libc::c_short,
            Some(
                server_client_free
                    as unsafe extern "C" fn(libc::c_int, libc::c_short, *mut libc::c_void) -> (),
            ),
            c as *mut libc::c_void,
            std::ptr::null::<timeval>(),
        );
    }
}
unsafe extern "C" fn server_client_free(
    mut fd: libc::c_int,
    mut events: libc::c_short,
    mut arg: *mut libc::c_void,
) {
    let mut c: *mut client = arg as *mut client;
    log_debug(
        b"free client %p (%d references)\0" as *const u8 as *const libc::c_char,
        c,
        (*c).references,
    );
    cmdq_free((*c).queue);
    if (*c).references == 0 as libc::c_int {
        free((*c).name as *mut libc::c_void);
        free(c as *mut libc::c_void);
    }
}
#[no_mangle]
pub unsafe extern "C" fn server_client_suspend(mut c: *mut client) {
    let mut s: *mut session = (*c).session;
    if s.is_null()
        || (*c).flags
            & (0x200 as libc::c_int | 0x40 as libc::c_int | 0x4 as libc::c_int) as libc::c_ulong
            != 0
    {
        return;
    }
    tty_stop_tty(&mut (*c).tty);
    (*c).flags |= 0x40 as libc::c_int as libc::c_ulong;
    proc_send(
        (*c).peer,
        MSG_SUSPEND,
        -(1 as libc::c_int),
        std::ptr::null::<libc::c_void>(),
        0 as libc::c_int as size_t,
    );
}
#[no_mangle]
pub unsafe extern "C" fn server_client_detach(mut c: *mut client, mut msgtype: msgtype) {
    let mut s: *mut session = (*c).session;
    if s.is_null() || (*c).flags & (0x200 as libc::c_int | 0x4 as libc::c_int) as libc::c_ulong != 0
    {
        return;
    }
    (*c).flags |= 0x4 as libc::c_int as libc::c_ulong;
    (*c).exit_type = CLIENT_EXIT_DETACH;
    (*c).exit_msgtype = msgtype;
    (*c).exit_session = xstrdup((*s).name);
}
#[no_mangle]
pub unsafe extern "C" fn server_client_exec(mut c: *mut client, mut cmd: *const libc::c_char) {
    let mut s: *mut session = (*c).session;
    let mut msg: *mut libc::c_char = std::ptr::null_mut::<libc::c_char>();
    let mut shell: *const libc::c_char = std::ptr::null::<libc::c_char>();
    let mut cmdsize: size_t = 0;
    let mut shellsize: size_t = 0;
    if *cmd as libc::c_int == '\0' as i32 {
        return;
    }
    cmdsize = (strlen(cmd)).wrapping_add(1 as libc::c_int as libc::c_ulong);
    if !s.is_null() {
        shell = options_get_string(
            (*s).options,
            b"default-shell\0" as *const u8 as *const libc::c_char,
        );
    } else {
        shell = options_get_string(
            global_s_options,
            b"default-shell\0" as *const u8 as *const libc::c_char,
        );
    }
    if checkshell(shell) == 0 {
        shell = b"/bin/sh\0" as *const u8 as *const libc::c_char;
    }
    shellsize = (strlen(shell)).wrapping_add(1 as libc::c_int as libc::c_ulong);
    msg = xmalloc(cmdsize.wrapping_add(shellsize)) as *mut libc::c_char;
    memcpy(
        msg as *mut libc::c_void,
        cmd as *const libc::c_void,
        cmdsize,
    );
    memcpy(
        msg.offset(cmdsize as isize) as *mut libc::c_void,
        shell as *const libc::c_void,
        shellsize,
    );
    proc_send(
        (*c).peer,
        MSG_EXEC,
        -(1 as libc::c_int),
        msg as *const libc::c_void,
        cmdsize.wrapping_add(shellsize),
    );
    free(msg as *mut libc::c_void);
}
unsafe extern "C" fn server_client_check_mouse(
    mut c: *mut client,
    mut event: *mut key_event,
) -> key_code {
    let mut current_block: u64;
    let mut m: *mut mouse_event = &mut (*event).m;
    let mut s: *mut session = (*c).session;
    let mut fs: *mut session = std::ptr::null_mut::<session>();
    let mut wo: *mut options = (*(*(*s).curw).window).options;
    let mut fwl: *mut winlink = std::ptr::null_mut::<winlink>();
    let mut wp: *mut window_pane = std::ptr::null_mut::<window_pane>();
    let mut fwp: *mut window_pane = std::ptr::null_mut::<window_pane>();
    let mut x: u_int = 0;
    let mut y: u_int = 0;
    let mut b: u_int = 0;
    let mut sx: u_int = 0;
    let mut sy: u_int = 0;
    let mut px: u_int = 0;
    let mut py: u_int = 0;
    let mut line: u_int = 0 as libc::c_int as u_int;
    let mut sb_pos: u_int = 0;
    let mut sl_top: u_int = 0;
    let mut sl_bottom: u_int = 0;
    let mut sl_mpos: u_int = 0 as libc::c_int as u_int;
    let mut ignore: libc::c_int = 0 as libc::c_int;
    let mut sb: libc::c_int = 0;
    let mut sb_w: libc::c_int = 0;
    let mut sb_pad: libc::c_int = 0;
    let mut pane_status: libc::c_int = 0;
    let mut key: key_code = 0;
    let mut tv: timeval = timeval {
        tv_sec: 0,
        tv_usec: 0,
    };
    let mut sr: *mut style_range = std::ptr::null_mut::<style_range>();
    let mut type_0: C2RustUnnamed_40 = NOTYPE;
    let mut where_0: C2RustUnnamed_39 = NOWHERE;
    log_debug(
        b"%s mouse %02x at %u,%u (last %u,%u) (%d)\0" as *const u8 as *const libc::c_char,
        (*c).name,
        (*m).b,
        (*m).x,
        (*m).y,
        (*m).lx,
        (*m).ly,
        (*c).tty.mouse_drag_flag,
    );
    if (*event).key == KEYC_DOUBLECLICK as libc::c_int as libc::c_ulonglong {
        type_0 = DOUBLE;
        x = (*m).x;
        y = (*m).y;
        b = (*m).b;
        ignore = 1 as libc::c_int;
        log_debug(
            b"double-click at %u,%u\0" as *const u8 as *const libc::c_char,
            x,
            y,
        );
    } else if (*m).sgr_type != ' ' as i32 as libc::c_uint
        && (*m).sgr_b & 32 as libc::c_int as libc::c_uint != 0
        && (*m).sgr_b & 195 as libc::c_int as libc::c_uint == 3 as libc::c_int as libc::c_uint
        || (*m).sgr_type == ' ' as i32 as libc::c_uint
            && (*m).b & 32 as libc::c_int as libc::c_uint != 0
            && (*m).b & 195 as libc::c_int as libc::c_uint == 3 as libc::c_int as libc::c_uint
            && (*m).lb & 195 as libc::c_int as libc::c_uint == 3 as libc::c_int as libc::c_uint
    {
        type_0 = MOVE;
        x = (*m).x;
        y = (*m).y;
        b = 0 as libc::c_int as u_int;
        log_debug(b"move at %u,%u\0" as *const u8 as *const libc::c_char, x, y);
    } else if (*m).b & 32 as libc::c_int as libc::c_uint != 0 {
        type_0 = DRAG;
        if (*c).tty.mouse_drag_flag != 0 {
            x = (*m).x;
            y = (*m).y;
            b = (*m).b;
            if x == (*m).lx && y == (*m).ly {
                return 0xfe000000000 as libc::c_ulonglong;
            }
            log_debug(
                b"drag update at %u,%u\0" as *const u8 as *const libc::c_char,
                x,
                y,
            );
        } else {
            x = (*m).lx;
            y = (*m).ly;
            b = (*m).lb;
            log_debug(
                b"drag start at %u,%u\0" as *const u8 as *const libc::c_char,
                x,
                y,
            );
        }
    } else if (*m).b & 195 as libc::c_int as libc::c_uint == 64 as libc::c_int as libc::c_uint
        || (*m).b & 195 as libc::c_int as libc::c_uint == 65 as libc::c_int as libc::c_uint
    {
        type_0 = WHEEL;
        x = (*m).x;
        y = (*m).y;
        b = (*m).b;
        log_debug(
            b"wheel at %u,%u\0" as *const u8 as *const libc::c_char,
            x,
            y,
        );
    } else if (*m).b & 195 as libc::c_int as libc::c_uint == 3 as libc::c_int as libc::c_uint {
        type_0 = UP;
        x = (*m).x;
        y = (*m).y;
        b = (*m).lb;
        if (*m).sgr_type == 'm' as i32 as libc::c_uint {
            b = (*m).sgr_b;
        }
        log_debug(b"up at %u,%u\0" as *const u8 as *const libc::c_char, x, y);
    } else {
        if (*c).flags & 0x100000 as libc::c_int as libc::c_ulong != 0 {
            event_del(&mut (*c).click_timer);
            (*c).flags &= !(0x100000 as libc::c_int) as libc::c_ulong;
            if (*m).b == (*c).click_button {
                type_0 = SECOND;
                x = (*m).x;
                y = (*m).y;
                b = (*m).b;
                log_debug(
                    b"second-click at %u,%u\0" as *const u8 as *const libc::c_char,
                    x,
                    y,
                );
                (*c).flags |= 0x200000 as libc::c_int as libc::c_ulong;
            }
            current_block = 3222590281903869779;
        } else if (*c).flags & 0x200000 as libc::c_int as libc::c_ulong != 0 {
            event_del(&mut (*c).click_timer);
            (*c).flags &= !(0x200000 as libc::c_int) as libc::c_ulong;
            if (*m).b == (*c).click_button {
                type_0 = TRIPLE;
                x = (*m).x;
                y = (*m).y;
                b = (*m).b;
                log_debug(
                    b"triple-click at %u,%u\0" as *const u8 as *const libc::c_char,
                    x,
                    y,
                );
                current_block = 14204977376561584160;
            } else {
                current_block = 3222590281903869779;
            }
        } else {
            current_block = 3222590281903869779;
        }
        match current_block {
            14204977376561584160 => {}
            _ => {
                if type_0 as libc::c_uint == NOTYPE as libc::c_int as libc::c_uint {
                    type_0 = DOWN;
                    x = (*m).x;
                    y = (*m).y;
                    b = (*m).b;
                    log_debug(b"down at %u,%u\0" as *const u8 as *const libc::c_char, x, y);
                    (*c).flags |= 0x100000 as libc::c_int as libc::c_ulong;
                }
                if 300 as libc::c_int != 0 as libc::c_int {
                    memcpy(
                        &mut (*c).click_event as *mut mouse_event as *mut libc::c_void,
                        m as *const libc::c_void,
                        ::core::mem::size_of::<mouse_event>() as libc::c_ulong,
                    );
                    (*c).click_button = (*m).b;
                    log_debug(b"click timer started\0" as *const u8 as *const libc::c_char);
                    tv.tv_sec = (300 as libc::c_int / 1000 as libc::c_int) as __time_t;
                    tv.tv_usec = (300 as libc::c_int % 1000 as libc::c_int) as libc::c_long
                        * 1000 as libc::c_long;
                    event_del(&mut (*c).click_timer);
                    event_add(&mut (*c).click_timer, &mut tv);
                }
            }
        }
    }
    if type_0 as libc::c_uint == NOTYPE as libc::c_int as libc::c_uint {
        return 0xfe000000000 as libc::c_ulonglong;
    }
    (*m).s = (*s).id as libc::c_int;
    (*m).w = -(1 as libc::c_int);
    (*m).wp = -(1 as libc::c_int);
    (*m).ignore = ignore;
    (*m).statusat = status_at_line(c);
    (*m).statuslines = status_line_size(c);
    if (*m).statusat != -(1 as libc::c_int)
        && y >= (*m).statusat as u_int
        && y < ((*m).statusat as libc::c_uint).wrapping_add((*m).statuslines)
    {
        sr = status_get_range(c, x, y.wrapping_sub((*m).statusat as libc::c_uint));
        if sr.is_null() {
            where_0 = STATUS_DEFAULT;
        } else {
            match (*sr).type_0 as libc::c_uint {
                0 => return 0xfe000000000 as libc::c_ulonglong,
                1 => {
                    log_debug(b"mouse range: left\0" as *const u8 as *const libc::c_char);
                    where_0 = STATUS_LEFT;
                }
                2 => {
                    log_debug(b"mouse range: right\0" as *const u8 as *const libc::c_char);
                    where_0 = STATUS_RIGHT;
                }
                3 => {
                    fwp = window_pane_find_by_id((*sr).argument);
                    if fwp.is_null() {
                        return 0xfe000000000 as libc::c_ulonglong;
                    }
                    (*m).wp = (*sr).argument as libc::c_int;
                    log_debug(
                        b"mouse range: pane %%%u\0" as *const u8 as *const libc::c_char,
                        (*m).wp,
                    );
                    where_0 = STATUS;
                }
                4 => {
                    fwl = winlink_find_by_index(&mut (*s).windows, (*sr).argument as libc::c_int);
                    if fwl.is_null() {
                        return 0xfe000000000 as libc::c_ulonglong;
                    }
                    (*m).w = (*(*fwl).window).id as libc::c_int;
                    log_debug(
                        b"mouse range: window @%u\0" as *const u8 as *const libc::c_char,
                        (*m).w,
                    );
                    where_0 = STATUS;
                }
                5 => {
                    fs = session_find_by_id((*sr).argument);
                    if fs.is_null() {
                        return 0xfe000000000 as libc::c_ulonglong;
                    }
                    (*m).s = (*sr).argument as libc::c_int;
                    log_debug(
                        b"mouse range: session $%u\0" as *const u8 as *const libc::c_char,
                        (*m).s,
                    );
                    where_0 = STATUS;
                }
                6 => {
                    where_0 = STATUS;
                }
                _ => {}
            }
        }
    }
    if where_0 as libc::c_uint == NOWHERE as libc::c_int as libc::c_uint {
        if (*c).tty.mouse_scrolling_flag != 0 {
            where_0 = SCROLLBAR_SLIDER;
        } else {
            px = x;
            if (*m).statusat == 0 as libc::c_int && y >= (*m).statuslines {
                py = y.wrapping_sub((*m).statuslines);
            } else if (*m).statusat > 0 as libc::c_int && y >= (*m).statusat as u_int {
                py = ((*m).statusat - 1 as libc::c_int) as u_int;
            } else {
                py = y;
            }
            tty_window_offset(&mut (*c).tty, &mut (*m).ox, &mut (*m).oy, &mut sx, &mut sy);
            log_debug(
                b"mouse window @%u at %u,%u (%ux%u)\0" as *const u8 as *const libc::c_char,
                (*(*(*s).curw).window).id,
                (*m).ox,
                (*m).oy,
                sx,
                sy,
            );
            if px > sx || py > sy {
                return 0xfe000000000 as libc::c_ulonglong;
            }
            px = px.wrapping_add((*m).ox);
            py = py.wrapping_add((*m).oy);
            wp = window_get_active_at((*(*s).curw).window, px, py);
            if wp.is_null() {
                return 0xfe000000000 as libc::c_ulonglong;
            }
            sb = options_get_number(wo, b"pane-scrollbars\0" as *const u8 as *const libc::c_char)
                as libc::c_int;
            sb_pos = options_get_number(
                wo,
                b"pane-scrollbars-position\0" as *const u8 as *const libc::c_char,
            ) as u_int;
            if window_pane_show_scrollbar(wp, sb) != 0 {
                sb_w = (*wp).scrollbar_style.width;
                sb_pad = (*wp).scrollbar_style.pad;
            } else {
                sb_w = 0 as libc::c_int;
                sb_pad = 0 as libc::c_int;
            }
            pane_status = options_get_number(
                wo,
                b"pane-border-status\0" as *const u8 as *const libc::c_char,
            ) as libc::c_int;
            if pane_status == 1 as libc::c_int {
                line = ((*wp).yoff).wrapping_sub(1 as libc::c_int as libc::c_uint);
            } else if pane_status == 2 as libc::c_int {
                line = ((*wp).yoff).wrapping_add((*wp).sy);
            }
            if pane_status != 0 as libc::c_int && py != line
                || (*wp).yoff == 0 as libc::c_int as libc::c_uint && py < (*wp).sy
                || py >= (*wp).yoff && py < ((*wp).yoff).wrapping_add((*wp).sy)
            {
                sb_pos = options_get_number(
                    wo,
                    b"pane-scrollbars-position\0" as *const u8 as *const libc::c_char,
                ) as u_int;
                if sb_pos == 0 as libc::c_int as libc::c_uint
                    && (px
                        >= ((*wp).xoff)
                            .wrapping_add((*wp).sx)
                            .wrapping_add(sb_pad as libc::c_uint)
                        && px
                            < ((*wp).xoff)
                                .wrapping_add((*wp).sx)
                                .wrapping_add(sb_pad as libc::c_uint)
                                .wrapping_add(sb_w as libc::c_uint))
                    || sb_pos == 1 as libc::c_int as libc::c_uint
                        && (px
                            >= ((*wp).xoff)
                                .wrapping_sub(sb_pad as libc::c_uint)
                                .wrapping_sub(sb_w as libc::c_uint)
                            && px < ((*wp).xoff).wrapping_sub(sb_pad as libc::c_uint))
                {
                    sl_top = ((*wp).yoff).wrapping_add((*wp).sb_slider_y);
                    sl_bottom = ((*wp).yoff)
                        .wrapping_add((*wp).sb_slider_y)
                        .wrapping_add((*wp).sb_slider_h)
                        .wrapping_sub(1 as libc::c_int as libc::c_uint);
                    if py < sl_top {
                        where_0 = SCROLLBAR_UP;
                    } else if py >= sl_top && py <= sl_bottom {
                        where_0 = SCROLLBAR_SLIDER;
                        sl_mpos = py.wrapping_sub((*wp).sb_slider_y).wrapping_sub((*wp).yoff);
                    } else {
                        where_0 = SCROLLBAR_DOWN;
                    }
                } else {
                    where_0 = PANE;
                }
            } else if !(*(*(*s).curw).window).flags & 0x8 as libc::c_int != 0 {
                wp = (*(*(*s).curw).window).panes.tqh_first;
                while !wp.is_null() {
                    if ((*wp).xoff).wrapping_add((*wp).sx) == px
                        && (*wp).yoff <= (1 as libc::c_int as libc::c_uint).wrapping_add(py)
                        && ((*wp).yoff).wrapping_add((*wp).sy) >= py
                        || ((*wp).yoff).wrapping_add((*wp).sy) == py
                            && (*wp).xoff <= (1 as libc::c_int as libc::c_uint).wrapping_add(px)
                            && ((*wp).xoff).wrapping_add((*wp).sx) >= px
                    {
                        break;
                    }
                    wp = (*wp).entry.tqe_next;
                }
                if !wp.is_null() {
                    where_0 = BORDER;
                }
            }
            if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                log_debug(
                    b"mouse %u,%u on pane %%%u\0" as *const u8 as *const libc::c_char,
                    x,
                    y,
                    (*wp).id,
                );
            } else if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                log_debug(
                    b"mouse on pane %%%u border\0" as *const u8 as *const libc::c_char,
                    (*wp).id,
                );
            } else if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint
                || where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint
                || where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint
            {
                log_debug(
                    b"mouse on pane %%%u scrollbar\0" as *const u8 as *const libc::c_char,
                    (*wp).id,
                );
            }
            (*m).wp = (*wp).id as libc::c_int;
            (*m).w = (*(*wp).window).id as libc::c_int;
        }
    } else {
        (*m).wp = -(1 as libc::c_int);
    }
    if type_0 as libc::c_uint != DRAG as libc::c_int as libc::c_uint
        && type_0 as libc::c_uint != WHEEL as libc::c_int as libc::c_uint
        && (*c).tty.mouse_drag_flag != 0 as libc::c_int
    {
        if ((*c).tty.mouse_drag_release).is_some() {
            ((*c).tty.mouse_drag_release).expect("non-null function pointer")(c, m);
        }
        (*c).tty.mouse_drag_update = None;
        (*c).tty.mouse_drag_release = None;
        (*c).tty.mouse_scrolling_flag = 0 as libc::c_int;
        match (*c).tty.mouse_drag_flag - 1 as libc::c_int {
            0 => {
                if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND1_PANE as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND1_STATUS as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND1_STATUS_LEFT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND1_STATUS_RIGHT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND1_STATUS_DEFAULT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND1_SCROLLBAR_SLIDER as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND1_BORDER as libc::c_int as key_code;
                }
            }
            1 => {
                if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND2_PANE as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND2_STATUS as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND2_STATUS_LEFT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND2_STATUS_RIGHT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND2_STATUS_DEFAULT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND2_SCROLLBAR_SLIDER as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND2_BORDER as libc::c_int as key_code;
                }
            }
            2 => {
                if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND3_PANE as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND3_STATUS as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND3_STATUS_LEFT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND3_STATUS_RIGHT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND3_STATUS_DEFAULT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND3_SCROLLBAR_SLIDER as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND3_BORDER as libc::c_int as key_code;
                }
            }
            66 => {
                if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND6_PANE as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND6_STATUS as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND6_STATUS_LEFT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND6_STATUS_RIGHT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND6_STATUS_DEFAULT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND6_SCROLLBAR_SLIDER as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND6_BORDER as libc::c_int as key_code;
                }
            }
            67 => {
                if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND7_PANE as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND7_STATUS as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND7_STATUS_LEFT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND7_STATUS_RIGHT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND7_STATUS_DEFAULT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND7_SCROLLBAR_SLIDER as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND7_BORDER as libc::c_int as key_code;
                }
            }
            128 => {
                if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND8_PANE as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND8_STATUS as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND8_STATUS_LEFT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND8_STATUS_RIGHT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND8_STATUS_DEFAULT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND8_SCROLLBAR_SLIDER as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND8_BORDER as libc::c_int as key_code;
                }
            }
            129 => {
                if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND9_PANE as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND9_STATUS as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND9_STATUS_LEFT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND9_STATUS_RIGHT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND9_STATUS_DEFAULT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND9_SCROLLBAR_SLIDER as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND9_BORDER as libc::c_int as key_code;
                }
            }
            130 => {
                if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND10_PANE as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND10_STATUS as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND10_STATUS_LEFT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND10_STATUS_RIGHT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND10_STATUS_DEFAULT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND10_SCROLLBAR_SLIDER as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND10_BORDER as libc::c_int as key_code;
                }
            }
            131 => {
                if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND11_PANE as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND11_STATUS as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND11_STATUS_LEFT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND11_STATUS_RIGHT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND11_STATUS_DEFAULT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND11_SCROLLBAR_SLIDER as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEDRAGEND11_BORDER as libc::c_int as key_code;
                }
            }
            _ => {
                key = KEYC_MOUSE as libc::c_int as key_code;
            }
        }
        (*c).tty.mouse_drag_flag = 0 as libc::c_int;
        (*c).tty.mouse_slider_mpos = -(1 as libc::c_int);
    } else {
        key = 0xfe000000000 as libc::c_ulonglong;
        match type_0 as libc::c_uint {
            1 => {
                if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEMOVE_PANE as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEMOVE_STATUS as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEMOVE_STATUS_LEFT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEMOVE_STATUS_RIGHT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEMOVE_STATUS_DEFAULT as libc::c_int as key_code;
                }
                if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                    key = KEYC_MOUSEMOVE_BORDER as libc::c_int as key_code;
                }
            }
            4 => {
                if ((*c).tty.mouse_drag_update).is_some() {
                    key = KEYC_DRAGGING as libc::c_int as key_code;
                } else {
                    match b & 195 as libc::c_int as libc::c_uint {
                        0 => {
                            if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG1_PANE as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG1_STATUS as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG1_STATUS_LEFT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_RIGHT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG1_STATUS_RIGHT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_DEFAULT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG1_STATUS_DEFAULT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_UP as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG1_SCROLLBAR_UP as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG1_SCROLLBAR_SLIDER as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_DOWN as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG1_SCROLLBAR_DOWN as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG1_BORDER as libc::c_int as key_code;
                            }
                        }
                        1 => {
                            if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG2_PANE as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG2_STATUS as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG2_STATUS_LEFT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_RIGHT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG2_STATUS_RIGHT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_DEFAULT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG2_STATUS_DEFAULT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_UP as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG2_SCROLLBAR_UP as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG2_SCROLLBAR_SLIDER as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_DOWN as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG2_SCROLLBAR_DOWN as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG2_BORDER as libc::c_int as key_code;
                            }
                        }
                        2 => {
                            if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG3_PANE as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG3_STATUS as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG3_STATUS_LEFT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_RIGHT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG3_STATUS_RIGHT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_DEFAULT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG3_STATUS_DEFAULT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_UP as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG3_SCROLLBAR_UP as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG3_SCROLLBAR_SLIDER as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_DOWN as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG3_SCROLLBAR_DOWN as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG3_BORDER as libc::c_int as key_code;
                            }
                        }
                        66 => {
                            if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG6_PANE as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG6_STATUS as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG6_STATUS_LEFT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_RIGHT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG6_STATUS_RIGHT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_DEFAULT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG6_STATUS_DEFAULT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_UP as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG6_SCROLLBAR_UP as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG6_SCROLLBAR_SLIDER as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_DOWN as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG6_SCROLLBAR_DOWN as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG6_BORDER as libc::c_int as key_code;
                            }
                        }
                        67 => {
                            if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG7_PANE as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG7_STATUS as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG7_STATUS_LEFT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_RIGHT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG7_STATUS_RIGHT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_DEFAULT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG7_STATUS_DEFAULT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_UP as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG7_SCROLLBAR_UP as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG7_SCROLLBAR_SLIDER as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_DOWN as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG7_SCROLLBAR_DOWN as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG7_BORDER as libc::c_int as key_code;
                            }
                        }
                        128 => {
                            if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG8_PANE as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG8_STATUS as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG8_STATUS_LEFT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_RIGHT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG8_STATUS_RIGHT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_DEFAULT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG8_STATUS_DEFAULT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_UP as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG8_SCROLLBAR_UP as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG8_SCROLLBAR_SLIDER as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_DOWN as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG8_SCROLLBAR_DOWN as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG8_BORDER as libc::c_int as key_code;
                            }
                        }
                        129 => {
                            if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG9_PANE as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG9_STATUS as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG9_STATUS_LEFT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_RIGHT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG9_STATUS_RIGHT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_DEFAULT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG9_STATUS_DEFAULT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_UP as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG9_SCROLLBAR_UP as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG9_SCROLLBAR_SLIDER as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_DOWN as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG9_SCROLLBAR_DOWN as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG9_BORDER as libc::c_int as key_code;
                            }
                        }
                        130 => {
                            if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG10_PANE as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG10_STATUS as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG10_STATUS_LEFT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_RIGHT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG10_STATUS_RIGHT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_DEFAULT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG10_STATUS_DEFAULT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_UP as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG10_SCROLLBAR_UP as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG10_SCROLLBAR_SLIDER as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_DOWN as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG10_SCROLLBAR_DOWN as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG10_BORDER as libc::c_int as key_code;
                            }
                        }
                        131 => {
                            if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG11_PANE as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG11_STATUS as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG11_STATUS_LEFT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_RIGHT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG11_STATUS_RIGHT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == STATUS_DEFAULT as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG11_STATUS_DEFAULT as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_UP as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG11_SCROLLBAR_UP as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG11_SCROLLBAR_SLIDER as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint
                                == SCROLLBAR_DOWN as libc::c_int as libc::c_uint
                            {
                                key = KEYC_MOUSEDRAG11_SCROLLBAR_DOWN as libc::c_int as key_code;
                            }
                            if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                                key = KEYC_MOUSEDRAG11_BORDER as libc::c_int as key_code;
                            }
                        }
                        _ => {}
                    }
                }
                (*c).tty.mouse_drag_flag = (b & 195 as libc::c_int as libc::c_uint)
                    .wrapping_add(1 as libc::c_int as libc::c_uint)
                    as libc::c_int;
                if (*c).tty.mouse_scrolling_flag == 0 as libc::c_int
                    && where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint
                {
                    (*c).tty.mouse_scrolling_flag = 1 as libc::c_int;
                    (*c).tty.mouse_slider_mpos = sl_mpos as libc::c_int;
                }
            }
            5 => {
                if b & 195 as libc::c_int as libc::c_uint == 64 as libc::c_int as libc::c_uint {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_WHEELUP_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_WHEELUP_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_WHEELUP_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_WHEELUP_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_WHEELUP_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_WHEELUP_BORDER as libc::c_int as key_code;
                    }
                } else {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_WHEELDOWN_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_WHEELDOWN_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_WHEELDOWN_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_WHEELDOWN_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_WHEELDOWN_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_WHEELDOWN_BORDER as libc::c_int as key_code;
                    }
                }
            }
            3 => match b & 195 as libc::c_int as libc::c_uint {
                0 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_BORDER as libc::c_int as key_code;
                    }
                }
                1 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP2_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP2_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP2_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP2_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP2_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP2_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP2_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP2_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP2_BORDER as libc::c_int as key_code;
                    }
                }
                2 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP3_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP3_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP3_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP3_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP3_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP3_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP3_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP3_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP3_BORDER as libc::c_int as key_code;
                    }
                }
                66 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP6_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP6_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP6_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP6_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP6_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP6_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP6_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP6_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP6_BORDER as libc::c_int as key_code;
                    }
                }
                67 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP7_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP7_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP7_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP7_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP7_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP7_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP7_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP7_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP7_BORDER as libc::c_int as key_code;
                    }
                }
                128 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP8_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP8_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP8_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP8_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP8_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP8_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP8_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP8_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP8_BORDER as libc::c_int as key_code;
                    }
                }
                129 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP9_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP9_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP9_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP9_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP9_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP9_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP9_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP9_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP9_BORDER as libc::c_int as key_code;
                    }
                }
                130 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP10_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP10_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP10_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP1_BORDER as libc::c_int as key_code;
                    }
                }
                131 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP11_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP11_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP11_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP11_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP11_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP11_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP11_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP11_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEUP11_BORDER as libc::c_int as key_code;
                    }
                }
                _ => {}
            },
            2 => match b & 195 as libc::c_int as libc::c_uint {
                0 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN1_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN1_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN1_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN1_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN1_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN1_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN1_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN1_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN1_BORDER as libc::c_int as key_code;
                    }
                }
                1 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN2_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN2_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN2_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN2_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN2_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN2_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN2_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN2_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN2_BORDER as libc::c_int as key_code;
                    }
                }
                2 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN3_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN3_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN3_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN3_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN3_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN3_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN3_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN3_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN3_BORDER as libc::c_int as key_code;
                    }
                }
                66 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN6_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN6_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN6_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN6_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN6_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN6_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN6_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN6_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN6_BORDER as libc::c_int as key_code;
                    }
                }
                67 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN7_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN7_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN7_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN7_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN7_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN7_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN7_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN7_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN7_BORDER as libc::c_int as key_code;
                    }
                }
                128 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN8_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN8_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN8_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN8_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN8_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN8_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN8_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN8_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN8_BORDER as libc::c_int as key_code;
                    }
                }
                129 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN9_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN9_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN9_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN9_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN9_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN9_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN9_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN9_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN9_BORDER as libc::c_int as key_code;
                    }
                }
                130 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN10_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN10_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN10_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN10_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN10_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN10_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN10_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN10_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN10_BORDER as libc::c_int as key_code;
                    }
                }
                131 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN11_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN11_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN11_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN11_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN11_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN11_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN11_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN11_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_MOUSEDOWN11_BORDER as libc::c_int as key_code;
                    }
                }
                _ => {}
            },
            6 => match b & 195 as libc::c_int as libc::c_uint {
                0 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK1_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK1_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK1_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK1_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK1_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK1_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK1_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK1_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK1_BORDER as libc::c_int as key_code;
                    }
                }
                1 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK2_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK2_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK2_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK2_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK2_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK2_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK2_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK2_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK2_BORDER as libc::c_int as key_code;
                    }
                }
                2 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK3_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK3_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK3_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK3_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK3_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK3_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK3_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK3_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK3_BORDER as libc::c_int as key_code;
                    }
                }
                66 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK6_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK6_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK6_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK6_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK6_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK6_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK6_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK6_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK6_BORDER as libc::c_int as key_code;
                    }
                }
                67 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK7_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK7_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK7_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK7_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK7_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK7_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK7_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK7_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK7_BORDER as libc::c_int as key_code;
                    }
                }
                128 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK8_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK8_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK8_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK8_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK8_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK8_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK8_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK8_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK8_BORDER as libc::c_int as key_code;
                    }
                }
                129 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK9_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK9_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK9_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK9_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK9_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK9_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK9_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK9_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK9_BORDER as libc::c_int as key_code;
                    }
                }
                130 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK10_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK10_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK10_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK10_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK10_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK10_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK10_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK10_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK10_BORDER as libc::c_int as key_code;
                    }
                }
                131 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK11_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK11_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK11_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK11_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK11_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK11_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK11_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK11_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_SECONDCLICK11_BORDER as libc::c_int as key_code;
                    }
                }
                _ => {}
            },
            7 => match b & 195 as libc::c_int as libc::c_uint {
                0 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK1_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK1_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK1_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK1_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK1_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK1_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK1_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK1_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK1_BORDER as libc::c_int as key_code;
                    }
                }
                1 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK2_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK2_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK2_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK2_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK2_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK2_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK2_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK2_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK2_BORDER as libc::c_int as key_code;
                    }
                }
                2 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK3_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK3_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK3_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK3_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK3_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK3_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK3_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK3_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK3_BORDER as libc::c_int as key_code;
                    }
                }
                66 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK6_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK6_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK6_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK6_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK6_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK6_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK6_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK6_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK6_BORDER as libc::c_int as key_code;
                    }
                }
                67 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK7_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK7_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK7_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK7_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK7_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK7_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK7_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK7_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK7_BORDER as libc::c_int as key_code;
                    }
                }
                128 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK8_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK8_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK8_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK8_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK8_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK8_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK8_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK8_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK8_BORDER as libc::c_int as key_code;
                    }
                }
                129 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK9_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK9_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK9_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK9_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK9_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK9_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK9_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK9_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK9_BORDER as libc::c_int as key_code;
                    }
                }
                130 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK10_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK10_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK10_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK10_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK10_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK10_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK10_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK10_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK10_BORDER as libc::c_int as key_code;
                    }
                }
                131 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK11_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK11_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK11_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK11_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK11_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK11_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK11_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK11_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_DOUBLECLICK11_BORDER as libc::c_int as key_code;
                    }
                }
                _ => {}
            },
            8 => match b & 195 as libc::c_int as libc::c_uint {
                0 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK1_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK1_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK1_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK1_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK1_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK1_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK1_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK1_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK1_BORDER as libc::c_int as key_code;
                    }
                }
                1 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK2_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK2_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK2_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK2_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK2_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK2_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK2_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK2_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK2_BORDER as libc::c_int as key_code;
                    }
                }
                2 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK3_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK3_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK3_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK3_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK3_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK3_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK3_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK3_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK3_BORDER as libc::c_int as key_code;
                    }
                }
                66 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK6_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK6_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK6_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK6_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK6_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK6_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK6_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK6_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK6_BORDER as libc::c_int as key_code;
                    }
                }
                67 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK7_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK7_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK7_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK7_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK7_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK7_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK7_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK7_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK7_BORDER as libc::c_int as key_code;
                    }
                }
                128 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK8_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK8_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK8_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK8_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK8_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK8_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK8_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK8_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK8_BORDER as libc::c_int as key_code;
                    }
                }
                129 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK9_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK9_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK9_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK9_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK9_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK9_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK9_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK9_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK9_BORDER as libc::c_int as key_code;
                    }
                }
                130 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK10_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK10_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK10_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK10_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK10_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK10_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK10_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK10_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK10_BORDER as libc::c_int as key_code;
                    }
                }
                131 => {
                    if where_0 as libc::c_uint == PANE as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK11_PANE as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK11_STATUS as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_LEFT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK11_STATUS_LEFT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_RIGHT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK11_STATUS_RIGHT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == STATUS_DEFAULT as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK11_STATUS_DEFAULT as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_UP as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK11_SCROLLBAR_UP as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_SLIDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK11_SCROLLBAR_SLIDER as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == SCROLLBAR_DOWN as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK11_SCROLLBAR_DOWN as libc::c_int as key_code;
                    }
                    if where_0 as libc::c_uint == BORDER as libc::c_int as libc::c_uint {
                        key = KEYC_TRIPLECLICK11_BORDER as libc::c_int as key_code;
                    }
                }
                _ => {}
            },
            0 | _ => {}
        }
        if key == 0xfe000000000 as libc::c_ulonglong {
            return 0xfe000000000 as libc::c_ulonglong;
        }
    }
    if b & 8 as libc::c_int as libc::c_uint != 0 {
        key |= 0x100000000000 as libc::c_ulonglong;
    }
    if b & 16 as libc::c_int as libc::c_uint != 0 {
        key |= 0x200000000000 as libc::c_ulonglong;
    }
    if b & 4 as libc::c_int as libc::c_uint != 0 {
        key |= 0x400000000000 as libc::c_ulonglong;
    }
    if log_get_level() != 0 as libc::c_int {
        log_debug(
            b"mouse key is %s\0" as *const u8 as *const libc::c_char,
            key_string_lookup_key(key, 1 as libc::c_int),
        );
    }
    return key;
}
unsafe extern "C" fn server_client_is_bracket_paste(
    mut c: *mut client,
    mut key: key_code,
) -> libc::c_int {
    if key == KEYC_PASTE_START as libc::c_int as libc::c_ulonglong {
        (*c).flags =
            ((*c).flags as libc::c_ulonglong | 0x1000000000 as libc::c_ulonglong) as uint64_t;
        log_debug(
            b"%s: bracket paste on\0" as *const u8 as *const libc::c_char,
            (*c).name,
        );
        return 0 as libc::c_int;
    }
    if key == KEYC_PASTE_END as libc::c_int as libc::c_ulonglong {
        (*c).flags =
            ((*c).flags as libc::c_ulonglong & !(0x1000000000 as libc::c_ulonglong)) as uint64_t;
        log_debug(
            b"%s: bracket paste off\0" as *const u8 as *const libc::c_char,
            (*c).name,
        );
        return 0 as libc::c_int;
    }
    return ((*c).flags as libc::c_ulonglong & 0x1000000000 as libc::c_ulonglong != 0)
        as libc::c_int;
}
unsafe extern "C" fn server_client_is_assume_paste(mut c: *mut client) -> libc::c_int {
    let mut s: *mut session = (*c).session;
    let mut tv: timeval = timeval {
        tv_sec: 0,
        tv_usec: 0,
    };
    let mut t: libc::c_int = 0;
    if (*c).flags as libc::c_ulonglong & 0x1000000000 as libc::c_ulonglong != 0 {
        return 0 as libc::c_int;
    }
    t = options_get_number(
        (*s).options,
        b"assume-paste-time\0" as *const u8 as *const libc::c_char,
    ) as libc::c_int;
    if t == 0 as libc::c_int {
        return 0 as libc::c_int;
    }
    tv.tv_sec = (*c).activity_time.tv_sec - (*c).last_activity_time.tv_sec;
    tv.tv_usec = (*c).activity_time.tv_usec - (*c).last_activity_time.tv_usec;
    if tv.tv_usec < 0 as libc::c_int as libc::c_long {
        tv.tv_sec -= 1;
        tv.tv_usec += 1000000 as libc::c_int as libc::c_long;
    }
    if tv.tv_sec == 0 as libc::c_int as libc::c_long
        && tv.tv_usec < (t * 1000 as libc::c_int) as libc::c_long
    {
        if (*c).flags as libc::c_ulonglong & 0x2000000000 as libc::c_ulonglong != 0 {
            return 1 as libc::c_int;
        }
        (*c).flags =
            ((*c).flags as libc::c_ulonglong | 0x2000000000 as libc::c_ulonglong) as uint64_t;
        log_debug(
            b"%s: assume paste on\0" as *const u8 as *const libc::c_char,
            (*c).name,
        );
        return 0 as libc::c_int;
    }
    if (*c).flags as libc::c_ulonglong & 0x2000000000 as libc::c_ulonglong != 0 {
        (*c).flags =
            ((*c).flags as libc::c_ulonglong & !(0x2000000000 as libc::c_ulonglong)) as uint64_t;
        log_debug(
            b"%s: assume paste off\0" as *const u8 as *const libc::c_char,
            (*c).name,
        );
    }
    return 0 as libc::c_int;
}
unsafe extern "C" fn server_client_update_latest(mut c: *mut client) {
    let mut w: *mut window = std::ptr::null_mut::<window>();
    if ((*c).session).is_null() {
        return;
    }
    w = (*(*(*c).session).curw).window;
    if (*w).latest == c as *mut libc::c_void {
        return;
    }
    (*w).latest = c as *mut libc::c_void;
    if options_get_number(
        (*w).options,
        b"window-size\0" as *const u8 as *const libc::c_char,
    ) == 3 as libc::c_int as libc::c_longlong
    {
        recalculate_size(w, 0 as libc::c_int);
    }
    notify_client(b"client-active\0" as *const u8 as *const libc::c_char, c);
}
unsafe extern "C" fn server_client_repeat_time(
    mut c: *mut client,
    mut bd: *mut key_binding,
) -> u_int {
    let mut s: *mut session = (*c).session;
    let mut repeat: u_int = 0;
    let mut initial: u_int = 0;
    if !(*bd).flags & 0x1 as libc::c_int != 0 {
        return 0 as libc::c_int as u_int;
    }
    repeat = options_get_number(
        (*s).options,
        b"repeat-time\0" as *const u8 as *const libc::c_char,
    ) as u_int;
    if repeat == 0 as libc::c_int as libc::c_uint {
        return 0 as libc::c_int as u_int;
    }
    if !(*c).flags & 0x20 as libc::c_int as libc::c_ulong != 0 || (*bd).key != (*c).last_key {
        initial = options_get_number(
            (*s).options,
            b"initial-repeat-time\0" as *const u8 as *const libc::c_char,
        ) as u_int;
        if initial != 0 as libc::c_int as libc::c_uint {
            repeat = initial;
        }
    }
    return repeat;
}
unsafe extern "C" fn server_client_key_callback(
    mut item: *mut cmdq_item,
    mut data: *mut libc::c_void,
) -> cmd_retval {
    let mut current_block: u64;
    let mut c: *mut client = cmdq_get_client(item);
    let mut event: *mut key_event = data as *mut key_event;
    let mut key: key_code = (*event).key;
    let mut m: *mut mouse_event = &mut (*event).m;
    let mut s: *mut session = (*c).session;
    let mut wl: *mut winlink = std::ptr::null_mut::<winlink>();
    let mut wp: *mut window_pane = std::ptr::null_mut::<window_pane>();
    let mut wme: *mut window_mode_entry = std::ptr::null_mut::<window_mode_entry>();
    let mut tv: timeval = timeval {
        tv_sec: 0,
        tv_usec: 0,
    };
    let mut table: *mut key_table = std::ptr::null_mut::<key_table>();
    let mut first: *mut key_table = std::ptr::null_mut::<key_table>();
    let mut bd: *mut key_binding = std::ptr::null_mut::<key_binding>();
    let mut repeat: u_int = 0;
    let mut flags: uint64_t = 0;
    let mut prefix_delay: uint64_t = 0;
    let mut fs: cmd_find_state = cmd_find_state {
        flags: 0,
        current: std::ptr::null_mut::<cmd_find_state>(),
        s: std::ptr::null_mut::<session>(),
        wl: std::ptr::null_mut::<winlink>(),
        w: std::ptr::null_mut::<window>(),
        wp: std::ptr::null_mut::<window_pane>(),
        idx: 0,
    };
    let mut key0: key_code = 0;
    let mut prefix: key_code = 0;
    let mut prefix2: key_code = 0;
    if !(s.is_null()
        || (*c).flags
            & (0x200 as libc::c_int | 0x40 as libc::c_int | 0x4 as libc::c_int) as libc::c_ulong
            != 0)
    {
        wl = (*s).curw;
        memcpy(
            &mut (*c).last_activity_time as *mut timeval as *mut libc::c_void,
            &mut (*c).activity_time as *mut timeval as *const libc::c_void,
            ::core::mem::size_of::<timeval>() as libc::c_ulong,
        );
        if gettimeofday(
            &mut (*c).activity_time,
            std::ptr::null_mut::<libc::c_void>(),
        ) != 0 as libc::c_int
        {
            fatal(b"gettimeofday failed\0" as *const u8 as *const libc::c_char);
        }
        session_update_activity(s, &mut (*c).activity_time);
        (*m).valid = 0 as libc::c_int;
        if key == KEYC_MOUSE as libc::c_int as libc::c_ulonglong
            || key == KEYC_DOUBLECLICK as libc::c_int as libc::c_ulonglong
        {
            if (*c).flags & 0x800 as libc::c_int as libc::c_ulong != 0 {
                current_block = 8253006531324708744;
            } else {
                key = server_client_check_mouse(c, event);
                if key == 0xfe000000000 as libc::c_ulonglong {
                    current_block = 8253006531324708744;
                } else {
                    (*m).valid = 1 as libc::c_int;
                    (*m).key = key;
                    if key & 0xfffffffffff as libc::c_ulonglong
                        == KEYC_DRAGGING as libc::c_int as libc::c_ulonglong
                    {
                        ((*c).tty.mouse_drag_update).expect("non-null function pointer")(c, m);
                        current_block = 8253006531324708744;
                    } else {
                        (*event).key = key;
                        current_block = 5948590327928692120;
                    }
                }
            }
        } else {
            current_block = 5948590327928692120;
        }
        match current_block {
            8253006531324708744 => {}
            _ => {
                if !(key & 0xfffffffffff as libc::c_ulonglong
                    >= KEYC_MOUSE as libc::c_int as libc::c_ulonglong
                    && (key & 0xfffffffffff as libc::c_ulonglong)
                        < KEYC_BSPACE as libc::c_int as libc::c_ulonglong)
                    || cmd_find_from_mouse(&mut fs, m, 0 as libc::c_int) != 0 as libc::c_int
                {
                    cmd_find_from_client(&mut fs, c, 0 as libc::c_int);
                }
                wp = fs.wp;
                if key & 0xfffffffffff as libc::c_ulonglong
                    >= KEYC_MOUSE as libc::c_int as libc::c_ulonglong
                    && (key & 0xfffffffffff as libc::c_ulonglong)
                        < KEYC_BSPACE as libc::c_int as libc::c_ulonglong
                    && options_get_number(
                        (*s).options,
                        b"mouse\0" as *const u8 as *const libc::c_char,
                    ) == 0
                {
                    current_block = 12172040871018923514;
                } else {
                    if server_client_is_bracket_paste(c, key) != 0 {
                        current_block = 14627853869430278777;
                    } else if !(key & 0xfffffffffff as libc::c_ulonglong
                        >= KEYC_MOUSE as libc::c_int as libc::c_ulonglong
                        && (key & 0xfffffffffff as libc::c_ulonglong)
                            < KEYC_BSPACE as libc::c_int as libc::c_ulonglong)
                        && key != KEYC_FOCUS_IN as libc::c_int as libc::c_ulonglong
                        && key != KEYC_FOCUS_OUT as libc::c_int as libc::c_ulonglong
                        && !key & 0x40000000000000 as libc::c_ulonglong != 0
                        && server_client_is_assume_paste(c) != 0
                    {
                        current_block = 14627853869430278777;
                    } else {
                        if server_client_is_default_key_table(c, (*c).keytable) != 0
                            && !wp.is_null()
                            && {
                                wme = (*wp).modes.tqh_first;
                                !wme.is_null()
                            }
                            && ((*(*wme).mode).key_table).is_some()
                        {
                            table = key_bindings_get_table(
                                ((*(*wme).mode).key_table).expect("non-null function pointer")(wme),
                                1 as libc::c_int,
                            );
                        } else {
                            table = (*c).keytable;
                        }
                        first = table;
                        '_table_changed: loop {
                            prefix = options_get_number(
                                (*s).options,
                                b"prefix\0" as *const u8 as *const libc::c_char,
                            ) as key_code;
                            prefix2 = options_get_number(
                                (*s).options,
                                b"prefix2\0" as *const u8 as *const libc::c_char,
                            ) as key_code;
                            key0 = key
                                & (0xfffffffffff as libc::c_ulonglong
                                    | 0xf00000000000 as libc::c_ulonglong);
                            if (key0
                                == prefix
                                    & (0xfffffffffff as libc::c_ulonglong
                                        | 0xf00000000000 as libc::c_ulonglong)
                                || key0
                                    == prefix2
                                        & (0xfffffffffff as libc::c_ulonglong
                                            | 0xf00000000000 as libc::c_ulonglong))
                                && strcmp(
                                    (*table).name,
                                    b"prefix\0" as *const u8 as *const libc::c_char,
                                ) != 0 as libc::c_int
                            {
                                server_client_set_key_table(
                                    c,
                                    b"prefix\0" as *const u8 as *const libc::c_char,
                                );
                                server_status_client(c);
                                current_block = 8253006531324708744;
                                break;
                            } else {
                                flags = (*c).flags;
                                loop {
                                    if wp.is_null() {
                                        log_debug(
                                            b"key table %s (no pane)\0" as *const u8
                                                as *const libc::c_char,
                                            (*table).name,
                                        );
                                    } else {
                                        log_debug(
                                            b"key table %s (pane %%%u)\0" as *const u8
                                                as *const libc::c_char,
                                            (*table).name,
                                            (*wp).id,
                                        );
                                    }
                                    if (*c).flags & 0x20 as libc::c_int as libc::c_ulong != 0 {
                                        log_debug(
                                            b"currently repeating\0" as *const u8
                                                as *const libc::c_char,
                                        );
                                    }
                                    bd = key_bindings_get(table, key0);
                                    prefix_delay = options_get_number(
                                        global_options,
                                        b"prefix-timeout\0" as *const u8 as *const libc::c_char,
                                    )
                                        as uint64_t;
                                    if prefix_delay > 0 as libc::c_int as libc::c_ulong
                                        && strcmp(
                                            (*table).name,
                                            b"prefix\0" as *const u8 as *const libc::c_char,
                                        ) == 0 as libc::c_int
                                        && server_client_key_table_activity_diff(c) > prefix_delay
                                    {
                                        if !bd.is_null()
                                            && (*c).flags & 0x20 as libc::c_int as libc::c_ulong
                                                != 0
                                            && (*bd).flags & 0x1 as libc::c_int != 0
                                        {
                                            log_debug(
                                                b"prefix timeout ignored, repeat is active\0"
                                                    as *const u8
                                                    as *const libc::c_char,
                                            );
                                        } else {
                                            log_debug(
                                                b"prefix timeout exceeded\0" as *const u8
                                                    as *const libc::c_char,
                                            );
                                            server_client_set_key_table(
                                                c,
                                                std::ptr::null::<libc::c_char>(),
                                            );
                                            table = (*c).keytable;
                                            first = table;
                                            server_status_client(c);
                                            continue '_table_changed;
                                        }
                                    }
                                    if !bd.is_null() {
                                        if (*c).flags & 0x20 as libc::c_int as libc::c_ulong != 0
                                            && !(*bd).flags & 0x1 as libc::c_int != 0
                                        {
                                            current_block = 6717214610478484138;
                                            break;
                                        } else {
                                            current_block = 14220266465818359136;
                                            break;
                                        }
                                    } else if key0 != KEYC_ANY as libc::c_int as libc::c_ulonglong {
                                        key0 = KEYC_ANY as libc::c_int as key_code;
                                    } else {
                                        if key
                                            == KEYC_MOUSEMOVE_PANE as libc::c_int
                                                as libc::c_ulonglong
                                            || key
                                                == KEYC_MOUSEMOVE_STATUS as libc::c_int
                                                    as libc::c_ulonglong
                                            || key
                                                == KEYC_MOUSEMOVE_STATUS_LEFT as libc::c_int
                                                    as libc::c_ulonglong
                                            || key
                                                == KEYC_MOUSEMOVE_STATUS_RIGHT as libc::c_int
                                                    as libc::c_ulonglong
                                            || key
                                                == KEYC_MOUSEMOVE_STATUS_DEFAULT as libc::c_int
                                                    as libc::c_ulonglong
                                            || key
                                                == KEYC_MOUSEMOVE_BORDER as libc::c_int
                                                    as libc::c_ulonglong
                                        {
                                            current_block = 12172040871018923514;
                                            break '_table_changed;
                                        }
                                        log_debug(
                                            b"not found in key table %s\0" as *const u8
                                                as *const libc::c_char,
                                            (*table).name,
                                        );
                                        if server_client_is_default_key_table(c, table) == 0
                                            || (*c).flags & 0x20 as libc::c_int as libc::c_ulong
                                                != 0
                                        {
                                            current_block = 981995395831942902;
                                            break;
                                        } else {
                                            current_block = 13853033528615664019;
                                            break;
                                        }
                                    }
                                }
                                match current_block {
                                    13853033528615664019 => {
                                        if first != table
                                            && !flags & 0x20 as libc::c_int as libc::c_ulong != 0
                                        {
                                            current_block = 7178192492338286402;
                                            break;
                                        } else {
                                            current_block = 12172040871018923514;
                                            break;
                                        }
                                    }
                                    14220266465818359136 => {
                                        log_debug(
                                            b"found in key table %s\0" as *const u8
                                                as *const libc::c_char,
                                            (*table).name,
                                        );
                                        (*table).references = ((*table).references).wrapping_add(1);
                                        repeat = server_client_repeat_time(c, bd);
                                        if repeat != 0 as libc::c_int as libc::c_uint {
                                            (*c).flags |= 0x20 as libc::c_int as libc::c_ulong;
                                            (*c).last_key = (*bd).key;
                                            tv.tv_sec = repeat
                                                .wrapping_div(1000 as libc::c_int as libc::c_uint)
                                                as __time_t;
                                            tv.tv_usec = repeat
                                                .wrapping_rem(1000 as libc::c_int as libc::c_uint)
                                                as libc::c_long
                                                * 1000 as libc::c_long;
                                            event_del(&mut (*c).repeat_timer);
                                            event_add(&mut (*c).repeat_timer, &mut tv);
                                        } else {
                                            (*c).flags &= !(0x20 as libc::c_int) as libc::c_ulong;
                                            server_client_set_key_table(
                                                c,
                                                std::ptr::null::<libc::c_char>(),
                                            );
                                        }
                                        server_status_client(c);
                                        key_bindings_dispatch(bd, item, c, event, &mut fs);
                                        key_bindings_unref_table(table);
                                        current_block = 8253006531324708744;
                                        break;
                                    }
                                    981995395831942902 => {
                                        log_debug(
                                            b"trying in root table\0" as *const u8
                                                as *const libc::c_char,
                                        );
                                        server_client_set_key_table(
                                            c,
                                            std::ptr::null::<libc::c_char>(),
                                        );
                                        table = (*c).keytable;
                                        if (*c).flags & 0x20 as libc::c_int as libc::c_ulong != 0 {
                                            first = table;
                                        }
                                        (*c).flags &= !(0x20 as libc::c_int) as libc::c_ulong;
                                        server_status_client(c);
                                    }
                                    _ => {
                                        log_debug(
                                            b"found in key table %s (not repeating)\0" as *const u8
                                                as *const libc::c_char,
                                            (*table).name,
                                        );
                                        server_client_set_key_table(
                                            c,
                                            std::ptr::null::<libc::c_char>(),
                                        );
                                        table = (*c).keytable;
                                        first = table;
                                        (*c).flags &= !(0x20 as libc::c_int) as libc::c_ulong;
                                        server_status_client(c);
                                    }
                                }
                            }
                        }
                        match current_block {
                            8253006531324708744 => {}
                            12172040871018923514 => {}
                            _ => {
                                server_client_set_key_table(c, std::ptr::null::<libc::c_char>());
                                server_status_client(c);
                                current_block = 8253006531324708744;
                            }
                        }
                    }
                    match current_block {
                        8253006531324708744 => {}
                        12172040871018923514 => {}
                        _ => {
                            if (*c).flags & 0x800 as libc::c_int as libc::c_ulong != 0 {
                                current_block = 8253006531324708744;
                            } else {
                                if !((*event).buf).is_null() {
                                    window_pane_paste(wp, (*event).buf, (*event).len);
                                }
                                key = 0xff000000000 as libc::c_ulonglong;
                                current_block = 8253006531324708744;
                            }
                        }
                    }
                }
                match current_block {
                    8253006531324708744 => {}
                    _ => {
                        if (*c).flags & 0x800 as libc::c_int as libc::c_ulong == 0 {
                            if !wp.is_null() {
                                window_pane_key(wp, c, s, wl, key, m);
                            }
                        }
                    }
                }
            }
        }
    }
    if !s.is_null() && key != KEYC_FOCUS_OUT as libc::c_int as libc::c_ulonglong {
        server_client_update_latest(c);
    }
    free((*event).buf as *mut libc::c_void);
    free(event as *mut libc::c_void);
    return CMD_RETURN_NORMAL;
}
#[no_mangle]
pub unsafe extern "C" fn server_client_handle_key(
    mut c: *mut client,
    mut event: *mut key_event,
) -> libc::c_int {
    let mut s: *mut session = (*c).session;
    let mut item: *mut cmdq_item = std::ptr::null_mut::<cmdq_item>();
    if s.is_null()
        || (*c).flags
            & (0x200 as libc::c_int | 0x40 as libc::c_int | 0x4 as libc::c_int) as libc::c_ulong
            != 0
    {
        return 0 as libc::c_int;
    }
    if !(*c).flags & 0x800 as libc::c_int as libc::c_ulong != 0 {
        if !((*c).message_string).is_null() {
            if (*c).message_ignore_keys != 0 {
                return 0 as libc::c_int;
            }
            status_message_clear(c);
        }
        if ((*c).overlay_key).is_some() {
            match ((*c).overlay_key).expect("non-null function pointer")(
                c,
                (*c).overlay_data,
                event,
            ) {
                0 => return 0 as libc::c_int,
                1 => {
                    server_client_clear_overlay(c);
                    return 0 as libc::c_int;
                }
                _ => {}
            }
        }
        server_client_clear_overlay(c);
        if !((*c).prompt_string).is_null() {
            if status_prompt_key(c, (*event).key) == 0 as libc::c_int {
                return 0 as libc::c_int;
            }
        }
    }
    item = cmdq_get_callback1(
        b"server_client_key_callback\0" as *const u8 as *const libc::c_char,
        Some(
            server_client_key_callback
                as unsafe extern "C" fn(*mut cmdq_item, *mut libc::c_void) -> cmd_retval,
        ),
        event as *mut libc::c_void,
    );
    cmdq_append(c, item);
    return 1 as libc::c_int;
}
#[no_mangle]
pub unsafe extern "C" fn server_client_loop() {
    let mut c: *mut client = std::ptr::null_mut::<client>();
    let mut w: *mut window = std::ptr::null_mut::<window>();
    let mut wp: *mut window_pane = std::ptr::null_mut::<window_pane>();
    w = windows_RB_MINMAX(&mut windows, -(1 as libc::c_int));
    while !w.is_null() {
        server_client_check_window_resize(w);
        w = windows_RB_NEXT(w);
    }
    c = clients.tqh_first;
    while !c.is_null() {
        server_client_check_exit(c);
        if !((*c).session).is_null() {
            server_client_check_modes(c);
            server_client_check_redraw(c);
            server_client_reset_state(c);
        }
        c = (*c).entry.tqe_next;
    }
    w = windows_RB_MINMAX(&mut windows, -(1 as libc::c_int));
    while !w.is_null() {
        wp = (*w).panes.tqh_first;
        while !wp.is_null() {
            if (*wp).fd != -(1 as libc::c_int) {
                server_client_check_pane_resize(wp);
                server_client_check_pane_buffer(wp);
            }
            (*wp).flags &= !(0x1 as libc::c_int | 0x4000 as libc::c_int);
            wp = (*wp).entry.tqe_next;
        }
        check_window_name(w);
        w = windows_RB_NEXT(w);
    }
}
unsafe extern "C" fn server_client_check_window_resize(mut w: *mut window) {
    let mut wl: *mut winlink = std::ptr::null_mut::<winlink>();
    if !(*w).flags & 0x20 as libc::c_int != 0 {
        return;
    }
    wl = (*w).winlinks.tqh_first;
    while !wl.is_null() {
        if (*(*wl).session).attached != 0 as libc::c_int as libc::c_uint
            && (*(*wl).session).curw == wl
        {
            break;
        }
        wl = (*wl).wentry.tqe_next;
    }
    if wl.is_null() {
        return;
    }
    log_debug(
        b"%s: resizing window @%u\0" as *const u8 as *const libc::c_char,
        (*::core::mem::transmute::<&[u8; 34], &[libc::c_char; 34]>(
            b"server_client_check_window_resize\0",
        ))
        .as_ptr(),
        (*w).id,
    );
    resize_window(
        w,
        (*w).new_sx,
        (*w).new_sy,
        (*w).new_xpixel as libc::c_int,
        (*w).new_ypixel as libc::c_int,
    );
}
unsafe extern "C" fn server_client_resize_timer(
    mut fd: libc::c_int,
    mut events: libc::c_short,
    mut data: *mut libc::c_void,
) {
    let mut wp: *mut window_pane = data as *mut window_pane;
    log_debug(
        b"%s: %%%u resize timer expired\0" as *const u8 as *const libc::c_char,
        (*::core::mem::transmute::<&[u8; 27], &[libc::c_char; 27]>(
            b"server_client_resize_timer\0",
        ))
        .as_ptr(),
        (*wp).id,
    );
    event_del(&mut (*wp).resize_timer);
}
unsafe extern "C" fn server_client_check_pane_resize(mut wp: *mut window_pane) {
    let mut r: *mut window_pane_resize = std::ptr::null_mut::<window_pane_resize>();
    let mut r1: *mut window_pane_resize = std::ptr::null_mut::<window_pane_resize>();
    let mut first: *mut window_pane_resize = std::ptr::null_mut::<window_pane_resize>();
    let mut last: *mut window_pane_resize = std::ptr::null_mut::<window_pane_resize>();
    let mut tv: timeval = {
        let mut init = timeval {
            tv_sec: 0,
            tv_usec: 250000 as libc::c_int as __suseconds_t,
        };
        init
    };
    if ((*wp).resize_queue.tqh_first).is_null() {
        return;
    }
    if event_initialized(&mut (*wp).resize_timer) == 0 {
        event_set(
            &mut (*wp).resize_timer,
            -(1 as libc::c_int),
            0 as libc::c_int as libc::c_short,
            Some(
                server_client_resize_timer
                    as unsafe extern "C" fn(libc::c_int, libc::c_short, *mut libc::c_void) -> (),
            ),
            wp as *mut libc::c_void,
        );
    }
    if event_pending(
        &mut (*wp).resize_timer,
        0x1 as libc::c_int as libc::c_short,
        std::ptr::null_mut::<timeval>(),
    ) != 0
    {
        return;
    }
    log_debug(
        b"%s: %%%u needs to be resized\0" as *const u8 as *const libc::c_char,
        (*::core::mem::transmute::<&[u8; 32], &[libc::c_char; 32]>(
            b"server_client_check_pane_resize\0",
        ))
        .as_ptr(),
        (*wp).id,
    );
    r = (*wp).resize_queue.tqh_first;
    while !r.is_null() {
        log_debug(
            b"queued resize: %ux%u -> %ux%u\0" as *const u8 as *const libc::c_char,
            (*r).osx,
            (*r).osy,
            (*r).sx,
            (*r).sy,
        );
        r = (*r).entry.tqe_next;
    }
    first = (*wp).resize_queue.tqh_first;
    last = *(*((*wp).resize_queue.tqh_last as *mut window_pane_resizes)).tqh_last;
    if first == last {
        window_pane_send_resize(wp, (*first).sx, (*first).sy);
        if !((*first).entry.tqe_next).is_null() {
            (*(*first).entry.tqe_next).entry.tqe_prev = (*first).entry.tqe_prev;
        } else {
            (*wp).resize_queue.tqh_last = (*first).entry.tqe_prev;
        }
        *(*first).entry.tqe_prev = (*first).entry.tqe_next;
        free(first as *mut libc::c_void);
    } else if (*last).sx != (*first).osx || (*last).sy != (*first).osy {
        window_pane_send_resize(wp, (*last).sx, (*last).sy);
        r = (*wp).resize_queue.tqh_first;
        while !r.is_null() && {
            r1 = (*r).entry.tqe_next;
            1 as libc::c_int != 0
        } {
            if !((*r).entry.tqe_next).is_null() {
                (*(*r).entry.tqe_next).entry.tqe_prev = (*r).entry.tqe_prev;
            } else {
                (*wp).resize_queue.tqh_last = (*r).entry.tqe_prev;
            }
            *(*r).entry.tqe_prev = (*r).entry.tqe_next;
            free(r as *mut libc::c_void);
            r = r1;
        }
    } else {
        r = *(*((*last).entry.tqe_prev as *mut window_pane_resizes)).tqh_last;
        window_pane_send_resize(wp, (*r).sx, (*r).sy);
        r = (*wp).resize_queue.tqh_first;
        while !r.is_null() && {
            r1 = (*r).entry.tqe_next;
            1 as libc::c_int != 0
        } {
            if r == last {
                break;
            }
            if !((*r).entry.tqe_next).is_null() {
                (*(*r).entry.tqe_next).entry.tqe_prev = (*r).entry.tqe_prev;
            } else {
                (*wp).resize_queue.tqh_last = (*r).entry.tqe_prev;
            }
            *(*r).entry.tqe_prev = (*r).entry.tqe_next;
            free(r as *mut libc::c_void);
            r = r1;
        }
        tv.tv_usec = 10000 as libc::c_int as __suseconds_t;
    }
    event_add(&mut (*wp).resize_timer, &mut tv);
}
unsafe extern "C" fn server_client_check_pane_buffer(mut wp: *mut window_pane) {
    let mut evb: *mut evbuffer = (*(*wp).event).input;
    let mut minimum: size_t = 0;
    let mut c: *mut client = std::ptr::null_mut::<client>();
    let mut wpo: *mut window_pane_offset = std::ptr::null_mut::<window_pane_offset>();
    let mut off: libc::c_int = 1 as libc::c_int;
    let mut flag: libc::c_int = 0;
    let mut attached_clients: u_int = 0 as libc::c_int as u_int;
    let mut new_size: size_t = 0;
    minimum = (*wp).offset.used;
    if (*wp).pipe_fd != -(1 as libc::c_int) && (*wp).pipe_offset.used < minimum {
        minimum = (*wp).pipe_offset.used;
    }
    c = clients.tqh_first;
    while !c.is_null() {
        if !((*c).session).is_null() {
            attached_clients = attached_clients.wrapping_add(1);
            if !(*c).flags & 0x2000 as libc::c_int as libc::c_ulong != 0 {
                off = 0 as libc::c_int;
            } else {
                wpo = control_pane_offset(c, wp, &mut flag);
                if wpo.is_null() {
                    if flag == 0 {
                        off = 0 as libc::c_int;
                    }
                } else {
                    if flag == 0 {
                        off = 0 as libc::c_int;
                    }
                    window_pane_get_new_data(wp, wpo, &mut new_size);
                    log_debug(
                        b"%s: %s has %zu bytes used and %zu left for %%%u\0" as *const u8
                            as *const libc::c_char,
                        (*::core::mem::transmute::<&[u8; 32], &[libc::c_char; 32]>(
                            b"server_client_check_pane_buffer\0",
                        ))
                        .as_ptr(),
                        (*c).name,
                        ((*wpo).used).wrapping_sub((*wp).base_offset),
                        new_size,
                        (*wp).id,
                    );
                    if (*wpo).used < minimum {
                        minimum = (*wpo).used;
                    }
                }
            }
        }
        c = (*c).entry.tqe_next;
    }
    if attached_clients == 0 as libc::c_int as libc::c_uint {
        off = 0 as libc::c_int;
    }
    minimum = (minimum as libc::c_ulong).wrapping_sub((*wp).base_offset) as size_t as size_t;
    if minimum != 0 as libc::c_int as libc::c_ulong {
        log_debug(
            b"%s: %%%u has %zu minimum (of %zu) bytes used\0" as *const u8 as *const libc::c_char,
            (*::core::mem::transmute::<&[u8; 32], &[libc::c_char; 32]>(
                b"server_client_check_pane_buffer\0",
            ))
            .as_ptr(),
            (*wp).id,
            minimum,
            evbuffer_get_length(evb),
        );
        evbuffer_drain(evb, minimum);
        if (*wp).base_offset > (18446744073709551615 as libc::c_ulong).wrapping_sub(minimum) {
            log_debug(
                b"%s: %%%u base offset has wrapped\0" as *const u8 as *const libc::c_char,
                (*::core::mem::transmute::<&[u8; 32], &[libc::c_char; 32]>(
                    b"server_client_check_pane_buffer\0",
                ))
                .as_ptr(),
                (*wp).id,
            );
            (*wp).offset.used = ((*wp).offset.used as libc::c_ulong).wrapping_sub((*wp).base_offset)
                as size_t as size_t;
            if (*wp).pipe_fd != -(1 as libc::c_int) {
                (*wp).pipe_offset.used = ((*wp).pipe_offset.used as libc::c_ulong)
                    .wrapping_sub((*wp).base_offset)
                    as size_t as size_t;
            }
            c = clients.tqh_first;
            while !c.is_null() {
                if !(((*c).session).is_null()
                    || !(*c).flags & 0x2000 as libc::c_int as libc::c_ulong != 0)
                {
                    wpo = control_pane_offset(c, wp, &mut flag);
                    if !wpo.is_null() && flag == 0 {
                        (*wpo).used = ((*wpo).used as libc::c_ulong).wrapping_sub((*wp).base_offset)
                            as size_t as size_t;
                    }
                }
                c = (*c).entry.tqe_next;
            }
            (*wp).base_offset = minimum;
        } else {
            (*wp).base_offset =
                ((*wp).base_offset as libc::c_ulong).wrapping_add(minimum) as size_t as size_t;
        }
    }
    log_debug(
        b"%s: pane %%%u is %s\0" as *const u8 as *const libc::c_char,
        (*::core::mem::transmute::<&[u8; 32], &[libc::c_char; 32]>(
            b"server_client_check_pane_buffer\0",
        ))
        .as_ptr(),
        (*wp).id,
        if off != 0 {
            b"off\0" as *const u8 as *const libc::c_char
        } else {
            b"on\0" as *const u8 as *const libc::c_char
        },
    );
    if off != 0 {
        bufferevent_disable((*wp).event, 0x2 as libc::c_int as libc::c_short);
    } else {
        bufferevent_enable((*wp).event, 0x2 as libc::c_int as libc::c_short);
    };
}
unsafe extern "C" fn server_client_reset_state(mut c: *mut client) {
    let mut tty: *mut tty = &mut (*c).tty;
    let mut w: *mut window = (*(*(*c).session).curw).window;
    let mut wp: *mut window_pane = server_client_get_pane(c);
    let mut loop_0: *mut window_pane = std::ptr::null_mut::<window_pane>();
    let mut s: *mut screen = std::ptr::null_mut::<screen>();
    let mut oo: *mut options = (*(*c).session).options;
    let mut mode: libc::c_int = 0 as libc::c_int;
    let mut cursor: libc::c_int = 0;
    let mut flags: libc::c_int = 0;
    let mut n: libc::c_int = 0;
    let mut cx: u_int = 0 as libc::c_int as u_int;
    let mut cy: u_int = 0 as libc::c_int as u_int;
    let mut ox: u_int = 0;
    let mut oy: u_int = 0;
    let mut sx: u_int = 0;
    let mut sy: u_int = 0;
    if (*c).flags & (0x2000 as libc::c_int | 0x40 as libc::c_int) as libc::c_ulong != 0 {
        return;
    }
    flags = (*tty).flags & 0x80 as libc::c_int;
    (*tty).flags &= !(0x80 as libc::c_int);
    if ((*c).overlay_draw).is_some() {
        if ((*c).overlay_mode).is_some() {
            s = ((*c).overlay_mode).expect("non-null function pointer")(
                c,
                (*c).overlay_data,
                &mut cx,
                &mut cy,
            );
        }
    } else if ((*c).prompt_string).is_null() {
        s = (*wp).screen;
    } else {
        s = (*c).status.active;
    }
    if !s.is_null() {
        mode = (*s).mode;
    }
    if log_get_level() != 0 as libc::c_int {
        log_debug(
            b"%s: client %s mode %s\0" as *const u8 as *const libc::c_char,
            (*::core::mem::transmute::<&[u8; 26], &[libc::c_char; 26]>(
                b"server_client_reset_state\0",
            ))
            .as_ptr(),
            (*c).name,
            screen_mode_to_string(mode),
        );
    }
    tty_region_off(tty);
    tty_margin_off(tty);
    if !((*c).prompt_string).is_null() {
        n = options_get_number(oo, b"status-position\0" as *const u8 as *const libc::c_char)
            as libc::c_int;
        if n == 0 as libc::c_int {
            cy = 0 as libc::c_int as u_int;
        } else {
            n = status_line_size(c) as libc::c_int;
            if n == 0 as libc::c_int {
                cy = ((*tty).sy).wrapping_sub(1 as libc::c_int as libc::c_uint);
            } else {
                cy = ((*tty).sy).wrapping_sub(n as libc::c_uint);
            }
        }
        cx = (*c).prompt_cursor as u_int;
    } else if ((*c).overlay_draw).is_none() {
        cursor = 0 as libc::c_int;
        tty_window_offset(tty, &mut ox, &mut oy, &mut sx, &mut sy);
        if ((*wp).xoff).wrapping_add((*s).cx) >= ox
            && ((*wp).xoff).wrapping_add((*s).cx) <= ox.wrapping_add(sx)
            && ((*wp).yoff).wrapping_add((*s).cy) >= oy
            && ((*wp).yoff).wrapping_add((*s).cy) <= oy.wrapping_add(sy)
        {
            cursor = 1 as libc::c_int;
            cx = ((*wp).xoff).wrapping_add((*s).cx).wrapping_sub(ox);
            cy = ((*wp).yoff).wrapping_add((*s).cy).wrapping_sub(oy);
            if status_at_line(c) == 0 as libc::c_int {
                cy = (cy as libc::c_uint).wrapping_add(status_line_size(c)) as u_int as u_int;
            }
        }
        if cursor == 0 {
            mode &= !(0x1 as libc::c_int);
        }
    }
    log_debug(
        b"%s: cursor to %u,%u\0" as *const u8 as *const libc::c_char,
        (*::core::mem::transmute::<&[u8; 26], &[libc::c_char; 26]>(b"server_client_reset_state\0"))
            .as_ptr(),
        cx,
        cy,
    );
    tty_cursor(tty, cx, cy);
    if options_get_number(oo, b"mouse\0" as *const u8 as *const libc::c_char) != 0 {
        if ((*c).overlay_draw).is_none() {
            mode &= !(0x20 as libc::c_int | 0x40 as libc::c_int | 0x1000 as libc::c_int);
            loop_0 = (*w).panes.tqh_first;
            while !loop_0.is_null() {
                if (*(*loop_0).screen).mode & 0x1000 as libc::c_int != 0 {
                    mode |= 0x1000 as libc::c_int;
                }
                loop_0 = (*loop_0).entry.tqe_next;
            }
        }
        if !mode & 0x1000 as libc::c_int != 0 {
            mode |= 0x40 as libc::c_int;
        }
    }
    if ((*c).overlay_draw).is_none() && !((*c).prompt_string).is_null() {
        mode &= !(0x400 as libc::c_int);
    }
    tty_update_mode(tty, mode, s);
    tty_reset(tty);
    tty_sync_end(tty);
    (*tty).flags |= flags;
}
unsafe extern "C" fn server_client_repeat_timer(
    mut fd: libc::c_int,
    mut events: libc::c_short,
    mut data: *mut libc::c_void,
) {
    let mut c: *mut client = data as *mut client;
    if (*c).flags & 0x20 as libc::c_int as libc::c_ulong != 0 {
        server_client_set_key_table(c, std::ptr::null::<libc::c_char>());
        (*c).flags &= !(0x20 as libc::c_int) as libc::c_ulong;
        server_status_client(c);
    }
}
unsafe extern "C" fn server_client_click_timer(
    mut fd: libc::c_int,
    mut events: libc::c_short,
    mut data: *mut libc::c_void,
) {
    let mut c: *mut client = data as *mut client;
    let mut event: *mut key_event = std::ptr::null_mut::<key_event>();
    log_debug(b"click timer expired\0" as *const u8 as *const libc::c_char);
    if (*c).flags & 0x200000 as libc::c_int as libc::c_ulong != 0 {
        event = xcalloc(
            1 as libc::c_int as size_t,
            ::core::mem::size_of::<key_event>() as libc::c_ulong,
        ) as *mut key_event;
        (*event).key = KEYC_DOUBLECLICK as libc::c_int as key_code;
        memcpy(
            &mut (*event).m as *mut mouse_event as *mut libc::c_void,
            &mut (*c).click_event as *mut mouse_event as *const libc::c_void,
            ::core::mem::size_of::<mouse_event>() as libc::c_ulong,
        );
        if server_client_handle_key(c, event) == 0 {
            free((*event).buf as *mut libc::c_void);
            free(event as *mut libc::c_void);
        }
    }
    (*c).flags &= !(0x100000 as libc::c_int | 0x200000 as libc::c_int) as libc::c_ulong;
}
unsafe extern "C" fn server_client_check_exit(mut c: *mut client) {
    let mut cf: *mut client_file = std::ptr::null_mut::<client_file>();
    let mut name: *const libc::c_char = (*c).exit_session;
    let mut data: *mut libc::c_char = std::ptr::null_mut::<libc::c_char>();
    let mut size: size_t = 0;
    let mut msize: size_t = 0;
    if (*c).flags & (0x200 as libc::c_int | 0x100 as libc::c_int) as libc::c_ulong != 0 {
        return;
    }
    if !(*c).flags & 0x4 as libc::c_int as libc::c_ulong != 0 {
        return;
    }
    if (*c).flags & 0x2000 as libc::c_int as libc::c_ulong != 0 {
        control_discard(c);
        if control_all_done(c) == 0 {
            return;
        }
    }
    cf = client_files_RB_MINMAX(&mut (*c).files, -(1 as libc::c_int));
    while !cf.is_null() {
        if evbuffer_get_length((*cf).buffer) != 0 as libc::c_int as libc::c_ulong {
            return;
        }
        cf = client_files_RB_NEXT(cf);
    }
    (*c).flags |= 0x100 as libc::c_int as libc::c_ulong;
    match (*c).exit_type as libc::c_uint {
        0 => {
            if !((*c).exit_message).is_null() {
                msize = (strlen((*c).exit_message)).wrapping_add(1 as libc::c_int as libc::c_ulong);
            } else {
                msize = 0 as libc::c_int as size_t;
            }
            size = (::core::mem::size_of::<libc::c_int>() as libc::c_ulong).wrapping_add(msize);
            data = xmalloc(size) as *mut libc::c_char;
            memcpy(
                data as *mut libc::c_void,
                &mut (*c).retval as *mut libc::c_int as *const libc::c_void,
                ::core::mem::size_of::<libc::c_int>() as libc::c_ulong,
            );
            if !((*c).exit_message).is_null() {
                memcpy(
                    data.offset(::core::mem::size_of::<libc::c_int>() as libc::c_ulong as isize)
                        as *mut libc::c_void,
                    (*c).exit_message as *const libc::c_void,
                    msize,
                );
            }
            proc_send(
                (*c).peer,
                MSG_EXIT,
                -(1 as libc::c_int),
                data as *const libc::c_void,
                size,
            );
            free(data as *mut libc::c_void);
        }
        1 => {
            proc_send(
                (*c).peer,
                MSG_SHUTDOWN,
                -(1 as libc::c_int),
                std::ptr::null::<libc::c_void>(),
                0 as libc::c_int as size_t,
            );
        }
        2 => {
            proc_send(
                (*c).peer,
                (*c).exit_msgtype,
                -(1 as libc::c_int),
                name as *const libc::c_void,
                (strlen(name)).wrapping_add(1 as libc::c_int as libc::c_ulong),
            );
        }
        _ => {}
    }
    free((*c).exit_session as *mut libc::c_void);
    free((*c).exit_message as *mut libc::c_void);
}
unsafe extern "C" fn server_client_redraw_timer(
    mut fd: libc::c_int,
    mut events: libc::c_short,
    mut data: *mut libc::c_void,
) {
    log_debug(b"redraw timer fired\0" as *const u8 as *const libc::c_char);
}
unsafe extern "C" fn server_client_check_modes(mut c: *mut client) {
    let mut w: *mut window = (*(*(*c).session).curw).window;
    let mut wp: *mut window_pane = std::ptr::null_mut::<window_pane>();
    let mut wme: *mut window_mode_entry = std::ptr::null_mut::<window_mode_entry>();
    if (*c).flags & (0x2000 as libc::c_int | 0x40 as libc::c_int) as libc::c_ulong != 0 {
        return;
    }
    if !(*c).flags & 0x10 as libc::c_int as libc::c_ulong != 0 {
        return;
    }
    wp = (*w).panes.tqh_first;
    while !wp.is_null() {
        wme = (*wp).modes.tqh_first;
        if !wme.is_null() && ((*(*wme).mode).update).is_some() {
            ((*(*wme).mode).update).expect("non-null function pointer")(wme);
        }
        wp = (*wp).entry.tqe_next;
    }
}
unsafe extern "C" fn server_client_check_redraw(mut c: *mut client) {
    let mut s: *mut session = (*c).session;
    let mut tty: *mut tty = &mut (*c).tty;
    let mut w: *mut window = (*(*(*c).session).curw).window;
    let mut wp: *mut window_pane = std::ptr::null_mut::<window_pane>();
    let mut needed: libc::c_int = 0;
    let mut tty_flags: libc::c_int = 0;
    let mut mode: libc::c_int = (*tty).mode;
    let mut client_flags: uint64_t = 0 as libc::c_int as uint64_t;
    let mut redraw_pane: libc::c_int = 0;
    let mut redraw_scrollbar_only: libc::c_int = 0;
    let mut bit: u_int = 0 as libc::c_int as u_int;
    let mut tv: timeval = {
        let mut init = timeval {
            tv_sec: 0,
            tv_usec: 1000 as libc::c_int as __suseconds_t,
        };
        init
    };
    static mut ev: event = event {
        ev_evcallback: event_callback {
            evcb_active_next: C2RustUnnamed_7 {
                tqe_next: 0 as *const event_callback as *mut event_callback,
                tqe_prev: 0 as *const *mut event_callback as *mut *mut event_callback,
            },
            evcb_flags: 0,
            evcb_pri: 0,
            evcb_closure: 0,
            evcb_cb_union: C2RustUnnamed_6 {
                evcb_callback: None,
            },
            evcb_arg: 0 as *const libc::c_void as *mut libc::c_void,
        },
        ev_timeout_pos: C2RustUnnamed_4 {
            ev_next_with_common_timeout: C2RustUnnamed_5 {
                tqe_next: 0 as *const event as *mut event,
                tqe_prev: 0 as *const *mut event as *mut *mut event,
            },
        },
        ev_fd: 0,
        ev_base: 0 as *const event_base as *mut event_base,
        ev_: C2RustUnnamed {
            ev_io: C2RustUnnamed_2 {
                ev_io_next: C2RustUnnamed_3 {
                    le_next: 0 as *const event as *mut event,
                    le_prev: 0 as *const *mut event as *mut *mut event,
                },
                ev_timeout: timeval {
                    tv_sec: 0,
                    tv_usec: 0,
                },
            },
        },
        ev_events: 0,
        ev_res: 0,
        ev_timeout: timeval {
            tv_sec: 0,
            tv_usec: 0,
        },
    };
    let mut left: size_t = 0;
    if (*c).flags & (0x2000 as libc::c_int | 0x40 as libc::c_int) as libc::c_ulong != 0 {
        return;
    }
    if (*c).flags as libc::c_ulonglong
        & ((0x8 as libc::c_int
            | 0x10 as libc::c_int
            | 0x1000000 as libc::c_int
            | 0x400 as libc::c_int
            | 0x2000000 as libc::c_int
            | 0x20000000 as libc::c_int) as libc::c_ulonglong
            | 0x4000000000 as libc::c_ulonglong)
        != 0
    {
        log_debug(
            b"%s: redraw%s%s%s%s%s%s\0" as *const u8 as *const libc::c_char,
            (*c).name,
            if (*c).flags & 0x8 as libc::c_int as libc::c_ulong != 0 {
                b" window\0" as *const u8 as *const libc::c_char
            } else {
                b"\0" as *const u8 as *const libc::c_char
            },
            if (*c).flags & 0x10 as libc::c_int as libc::c_ulong != 0 {
                b" status\0" as *const u8 as *const libc::c_char
            } else {
                b"\0" as *const u8 as *const libc::c_char
            },
            if (*c).flags & 0x400 as libc::c_int as libc::c_ulong != 0 {
                b" borders\0" as *const u8 as *const libc::c_char
            } else {
                b"\0" as *const u8 as *const libc::c_char
            },
            if (*c).flags & 0x2000000 as libc::c_int as libc::c_ulong != 0 {
                b" overlay\0" as *const u8 as *const libc::c_char
            } else {
                b"\0" as *const u8 as *const libc::c_char
            },
            if (*c).flags & 0x20000000 as libc::c_int as libc::c_ulong != 0 {
                b" panes\0" as *const u8 as *const libc::c_char
            } else {
                b"\0" as *const u8 as *const libc::c_char
            },
            if (*c).flags as libc::c_ulonglong & 0x4000000000 as libc::c_ulonglong != 0 {
                b" scrollbars\0" as *const u8 as *const libc::c_char
            } else {
                b"\0" as *const u8 as *const libc::c_char
            },
        );
    }
    needed = 0 as libc::c_int;
    if (*c).flags as libc::c_ulonglong
        & ((0x8 as libc::c_int
            | 0x10 as libc::c_int
            | 0x1000000 as libc::c_int
            | 0x400 as libc::c_int
            | 0x2000000 as libc::c_int
            | 0x20000000 as libc::c_int) as libc::c_ulonglong
            | 0x4000000000 as libc::c_ulonglong)
        != 0
    {
        needed = 1 as libc::c_int;
    } else {
        wp = (*w).panes.tqh_first;
        while !wp.is_null() {
            if (*wp).flags & 0x1 as libc::c_int != 0 {
                needed = 1 as libc::c_int;
                client_flags |= 0x20000000 as libc::c_int as libc::c_ulong;
                break;
            } else {
                if (*wp).flags & 0x4000 as libc::c_int != 0 {
                    needed = 1 as libc::c_int;
                    client_flags = (client_flags as libc::c_ulonglong
                        | 0x4000000000 as libc::c_ulonglong)
                        as uint64_t;
                }
                wp = (*wp).entry.tqe_next;
            }
        }
    }
    if needed != 0 && {
        left = evbuffer_get_length((*tty).out);
        left != 0 as libc::c_int as libc::c_ulong
    } {
        log_debug(
            b"%s: redraw deferred (%zu left)\0" as *const u8 as *const libc::c_char,
            (*c).name,
            left,
        );
        if event_initialized(&mut ev) == 0 {
            event_set(
                &mut ev,
                -(1 as libc::c_int),
                0 as libc::c_int as libc::c_short,
                Some(
                    server_client_redraw_timer
                        as unsafe extern "C" fn(
                            libc::c_int,
                            libc::c_short,
                            *mut libc::c_void,
                        ) -> (),
                ),
                std::ptr::null_mut::<libc::c_void>(),
            );
        }
        if event_pending(
            &mut ev,
            0x1 as libc::c_int as libc::c_short,
            std::ptr::null_mut::<timeval>(),
        ) == 0
        {
            log_debug(b"redraw timer started\0" as *const u8 as *const libc::c_char);
            event_add(&mut ev, &mut tv);
        }
        if !(*c).flags & 0x8 as libc::c_int as libc::c_ulong != 0 {
            wp = (*w).panes.tqh_first;
            while !wp.is_null() {
                if (*wp).flags & 0x1 as libc::c_int != 0 {
                    log_debug(
                        b"%s: pane %%%u needs redraw\0" as *const u8 as *const libc::c_char,
                        (*c).name,
                        (*wp).id,
                    );
                    (*c).redraw_panes |= ((1 as libc::c_int) << bit) as libc::c_ulong;
                } else if (*wp).flags & 0x4000 as libc::c_int != 0 {
                    log_debug(
                        b"%s: pane %%%u scrollbar needs redraw\0" as *const u8
                            as *const libc::c_char,
                        (*c).name,
                        (*wp).id,
                    );
                    (*c).redraw_scrollbars |= ((1 as libc::c_int) << bit) as libc::c_ulong;
                }
                bit = bit.wrapping_add(1);
                if bit == 64 as libc::c_int as libc::c_uint {
                    client_flags = (client_flags as libc::c_ulonglong
                        & !(0x20000000 as libc::c_int as libc::c_ulonglong
                            | 0x4000000000 as libc::c_ulonglong))
                        as uint64_t;
                    client_flags |= 0x8 as libc::c_int as libc::c_ulong;
                    break;
                } else {
                    wp = (*wp).entry.tqe_next;
                }
            }
            if (*c).redraw_panes != 0 as libc::c_int as libc::c_ulong {
                (*c).flags |= 0x20000000 as libc::c_int as libc::c_ulong;
            }
            if (*c).redraw_scrollbars != 0 as libc::c_int as libc::c_ulong {
                (*c).flags = ((*c).flags as libc::c_ulonglong | 0x4000000000 as libc::c_ulonglong)
                    as uint64_t;
            }
        }
        (*c).flags |= client_flags;
        return;
    } else {
        if needed != 0 {
            log_debug(
                b"%s: redraw needed\0" as *const u8 as *const libc::c_char,
                (*c).name,
            );
        }
    }
    tty_flags = (*tty).flags & (0x80 as libc::c_int | 0x2 as libc::c_int | 0x1 as libc::c_int);
    (*tty).flags = (*tty).flags & !(0x80 as libc::c_int | 0x2 as libc::c_int) | 0x1 as libc::c_int;
    if !(*c).flags & 0x8 as libc::c_int as libc::c_ulong != 0 {
        wp = (*w).panes.tqh_first;
        while !wp.is_null() {
            redraw_pane = 0 as libc::c_int;
            redraw_scrollbar_only = 0 as libc::c_int;
            if (*wp).flags & 0x1 as libc::c_int != 0 {
                redraw_pane = 1 as libc::c_int;
            } else if (*c).flags & 0x20000000 as libc::c_int as libc::c_ulong != 0 {
                if (*c).redraw_panes & ((1 as libc::c_int) << bit) as libc::c_ulong != 0 {
                    redraw_pane = 1 as libc::c_int;
                }
            } else if (*c).flags as libc::c_ulonglong & 0x4000000000 as libc::c_ulonglong != 0 {
                if (*c).redraw_scrollbars & ((1 as libc::c_int) << bit) as libc::c_ulong != 0 {
                    redraw_scrollbar_only = 1 as libc::c_int;
                }
            }
            bit = bit.wrapping_add(1);
            if !(redraw_pane == 0 && redraw_scrollbar_only == 0) {
                if redraw_scrollbar_only != 0 {
                    log_debug(
                        b"%s: redrawing (scrollbar only) pane %%%u\0" as *const u8
                            as *const libc::c_char,
                        (*::core::mem::transmute::<&[u8; 27], &[libc::c_char; 27]>(
                            b"server_client_check_redraw\0",
                        ))
                        .as_ptr(),
                        (*wp).id,
                    );
                } else {
                    log_debug(
                        b"%s: redrawing pane %%%u\0" as *const u8 as *const libc::c_char,
                        (*::core::mem::transmute::<&[u8; 27], &[libc::c_char; 27]>(
                            b"server_client_check_redraw\0",
                        ))
                        .as_ptr(),
                        (*wp).id,
                    );
                }
                screen_redraw_pane(c, wp, redraw_scrollbar_only);
            }
            wp = (*wp).entry.tqe_next;
        }
        (*c).redraw_panes = 0 as libc::c_int as uint64_t;
        (*c).redraw_scrollbars = 0 as libc::c_int as uint64_t;
        (*c).flags = ((*c).flags as libc::c_ulonglong
            & !(0x20000000 as libc::c_int as libc::c_ulonglong | 0x4000000000 as libc::c_ulonglong))
            as uint64_t;
    }
    if (*c).flags as libc::c_ulonglong
        & ((0x8 as libc::c_int
            | 0x10 as libc::c_int
            | 0x1000000 as libc::c_int
            | 0x400 as libc::c_int
            | 0x2000000 as libc::c_int
            | 0x20000000 as libc::c_int) as libc::c_ulonglong
            | 0x4000000000 as libc::c_ulonglong)
        != 0
    {
        if options_get_number(
            (*s).options,
            b"set-titles\0" as *const u8 as *const libc::c_char,
        ) != 0
        {
            server_client_set_title(c);
            server_client_set_path(c);
        }
        screen_redraw_screen(c);
    }
    (*tty).flags = (*tty).flags & !(0x1 as libc::c_int) | tty_flags & 0x1 as libc::c_int;
    tty_update_mode(tty, mode, std::ptr::null_mut::<screen>());
    (*tty).flags =
        (*tty).flags & !(0x80 as libc::c_int | 0x2 as libc::c_int | 0x1 as libc::c_int) | tty_flags;
    (*c).flags = ((*c).flags as libc::c_ulonglong
        & !((0x8 as libc::c_int
            | 0x10 as libc::c_int
            | 0x1000000 as libc::c_int
            | 0x400 as libc::c_int
            | 0x2000000 as libc::c_int
            | 0x20000000 as libc::c_int) as libc::c_ulonglong
            | 0x4000000000 as libc::c_ulonglong
            | 0x80000 as libc::c_int as libc::c_ulonglong)) as uint64_t;
    if needed != 0 {
        (*c).redraw = evbuffer_get_length((*tty).out);
        log_debug(
            b"%s: redraw added %zu bytes\0" as *const u8 as *const libc::c_char,
            (*c).name,
            (*c).redraw,
        );
    }
}
unsafe extern "C" fn server_client_set_title(mut c: *mut client) {
    let mut s: *mut session = (*c).session;
    let mut template: *const libc::c_char = std::ptr::null::<libc::c_char>();
    let mut title: *mut libc::c_char = std::ptr::null_mut::<libc::c_char>();
    let mut ft: *mut format_tree = std::ptr::null_mut::<format_tree>();
    template = options_get_string(
        (*s).options,
        b"set-titles-string\0" as *const u8 as *const libc::c_char,
    );
    ft = format_create(
        c,
        std::ptr::null_mut::<cmdq_item>(),
        0 as libc::c_int,
        0 as libc::c_int,
    );
    format_defaults(
        ft,
        c,
        std::ptr::null_mut::<session>(),
        std::ptr::null_mut::<winlink>(),
        std::ptr::null_mut::<window_pane>(),
    );
    title = format_expand_time(ft, template);
    if ((*c).title).is_null() || strcmp(title, (*c).title) != 0 as libc::c_int {
        free((*c).title as *mut libc::c_void);
        (*c).title = xstrdup(title);
        tty_set_title(&mut (*c).tty, (*c).title);
    }
    free(title as *mut libc::c_void);
    format_free(ft);
}
unsafe extern "C" fn server_client_set_path(mut c: *mut client) {
    let mut s: *mut session = (*c).session;
    let mut path: *const libc::c_char = std::ptr::null::<libc::c_char>();
    if ((*s).curw).is_null() {
        return;
    }
    if ((*(*(*(*s).curw).window).active).base.path).is_null() {
        path = b"\0" as *const u8 as *const libc::c_char;
    } else {
        path = (*(*(*(*s).curw).window).active).base.path;
    }
    if ((*c).path).is_null() || strcmp(path, (*c).path) != 0 as libc::c_int {
        free((*c).path as *mut libc::c_void);
        (*c).path = xstrdup(path);
        tty_set_path(&mut (*c).tty, (*c).path);
    }
}
unsafe extern "C" fn server_client_dispatch(mut imsg: *mut imsg, mut arg: *mut libc::c_void) {
    let mut c: *mut client = arg as *mut client;
    let mut datalen: ssize_t = 0;
    let mut s: *mut session = std::ptr::null_mut::<session>();
    if (*c).flags & 0x200 as libc::c_int as libc::c_ulong != 0 {
        return;
    }
    if imsg.is_null() {
        server_client_lost(c);
        return;
    }
    datalen = ((*imsg).hdr.len as libc::c_ulong)
        .wrapping_sub(::core::mem::size_of::<imsg_hdr>() as libc::c_ulong) as ssize_t;
    match (*imsg).hdr.type_0 {
        107 | 108 | 105 | 109 | 100 | 111 | 104 | 110 | 101 | 112 | 102 | 106 => {
            server_client_dispatch_identify(c, imsg);
        }
        200 => {
            server_client_dispatch_command(c, imsg);
        }
        208 => {
            if datalen != 0 as libc::c_int as libc::c_long {
                fatalx(b"bad MSG_RESIZE size\0" as *const u8 as *const libc::c_char);
            }
            if (*c).flags & 0x2000 as libc::c_int as libc::c_ulong == 0 {
                server_client_update_latest(c);
                tty_resize(&mut (*c).tty);
                tty_repeat_requests(&mut (*c).tty);
                recalculate_sizes();
                if ((*c).overlay_resize).is_none() {
                    server_client_clear_overlay(c);
                } else {
                    ((*c).overlay_resize).expect("non-null function pointer")(c, (*c).overlay_data);
                }
                server_redraw_client(c);
                if !((*c).session).is_null() {
                    notify_client(b"client-resized\0" as *const u8 as *const libc::c_char, c);
                }
            }
        }
        205 => {
            if datalen != 0 as libc::c_int as libc::c_long {
                fatalx(b"bad MSG_EXITING size\0" as *const u8 as *const libc::c_char);
            }
            server_client_set_session(c, std::ptr::null_mut::<session>());
            recalculate_sizes();
            tty_close(&mut (*c).tty);
            proc_send(
                (*c).peer,
                MSG_EXITED,
                -(1 as libc::c_int),
                std::ptr::null::<libc::c_void>(),
                0 as libc::c_int as size_t,
            );
        }
        216 | 215 => {
            if datalen != 0 as libc::c_int as libc::c_long {
                fatalx(b"bad MSG_WAKEUP size\0" as *const u8 as *const libc::c_char);
            }
            if (*c).flags & 0x40 as libc::c_int as libc::c_ulong != 0 {
                (*c).flags &= !(0x40 as libc::c_int) as libc::c_ulong;
                if !((*c).fd == -(1 as libc::c_int) || ((*c).session).is_null()) {
                    s = (*c).session;
                    if gettimeofday(
                        &mut (*c).activity_time,
                        std::ptr::null_mut::<libc::c_void>(),
                    ) != 0 as libc::c_int
                    {
                        fatal(b"gettimeofday failed\0" as *const u8 as *const libc::c_char);
                    }
                    tty_start_tty(&mut (*c).tty);
                    server_redraw_client(c);
                    recalculate_sizes();
                    if !s.is_null() {
                        session_update_activity(s, &mut (*c).activity_time);
                    }
                }
            }
        }
        209 => {
            if datalen != 0 as libc::c_int as libc::c_long {
                fatalx(b"bad MSG_SHELL size\0" as *const u8 as *const libc::c_char);
            }
            server_client_dispatch_shell(c);
        }
        305 => {
            file_write_ready(&mut (*c).files, imsg);
        }
        301 => {
            file_read_data(&mut (*c).files, imsg);
        }
        302 => {
            file_read_done(&mut (*c).files, imsg);
        }
        _ => {}
    };
}
unsafe extern "C" fn server_client_read_only(
    mut item: *mut cmdq_item,
    mut data: *mut libc::c_void,
) -> cmd_retval {
    cmdq_error(
        item,
        b"client is read-only\0" as *const u8 as *const libc::c_char,
    );
    return CMD_RETURN_ERROR;
}
unsafe extern "C" fn server_client_command_done(
    mut item: *mut cmdq_item,
    mut data: *mut libc::c_void,
) -> cmd_retval {
    let mut c: *mut client = cmdq_get_client(item);
    if !(*c).flags & 0x80 as libc::c_int as libc::c_ulong != 0 {
        (*c).flags |= 0x4 as libc::c_int as libc::c_ulong;
    } else if !(*c).flags & 0x4 as libc::c_int as libc::c_ulong != 0 {
        if (*c).flags & 0x2000 as libc::c_int as libc::c_ulong != 0 {
            control_ready(c);
        }
        tty_send_requests(&mut (*c).tty);
    }
    return CMD_RETURN_NORMAL;
}
unsafe extern "C" fn server_client_dispatch_command(mut c: *mut client, mut imsg: *mut imsg) {
    let mut data: msg_command = msg_command { argc: 0 };
    let mut buf: *mut libc::c_char = std::ptr::null_mut::<libc::c_char>();
    let mut len: size_t = 0;
    let mut argc: libc::c_int = 0;
    let mut argv: *mut *mut libc::c_char = std::ptr::null_mut::<*mut libc::c_char>();
    let mut cause: *mut libc::c_char = std::ptr::null_mut::<libc::c_char>();
    let mut pr: *mut cmd_parse_result = std::ptr::null_mut::<cmd_parse_result>();
    let mut values: *mut args_value = std::ptr::null_mut::<args_value>();
    let mut new_item: *mut cmdq_item = std::ptr::null_mut::<cmdq_item>();
    if (*c).flags & 0x4 as libc::c_int as libc::c_ulong != 0 {
        return;
    }
    if ((*imsg).hdr.len as libc::c_ulong)
        .wrapping_sub(::core::mem::size_of::<imsg_hdr>() as libc::c_ulong)
        < ::core::mem::size_of::<msg_command>() as libc::c_ulong
    {
        fatalx(b"bad MSG_COMMAND size\0" as *const u8 as *const libc::c_char);
    }
    memcpy(
        &mut data as *mut msg_command as *mut libc::c_void,
        (*imsg).data,
        ::core::mem::size_of::<msg_command>() as libc::c_ulong,
    );
    buf = ((*imsg).data as *mut libc::c_char)
        .offset(::core::mem::size_of::<msg_command>() as libc::c_ulong as isize);
    len = ((*imsg).hdr.len as libc::c_ulong)
        .wrapping_sub(::core::mem::size_of::<imsg_hdr>() as libc::c_ulong)
        .wrapping_sub(::core::mem::size_of::<msg_command>() as libc::c_ulong);
    if len > 0 as libc::c_int as libc::c_ulong
        && *buf.offset(len.wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize) as libc::c_int
            != '\0' as i32
    {
        fatalx(b"bad MSG_COMMAND string\0" as *const u8 as *const libc::c_char);
    }
    argc = data.argc;
    if cmd_unpack_argv(buf, len, argc, &mut argv) != 0 as libc::c_int {
        cause = xstrdup(b"command too long\0" as *const u8 as *const libc::c_char);
    } else {
        if argc == 0 as libc::c_int {
            argc = 1 as libc::c_int;
            argv = xcalloc(
                1 as libc::c_int as size_t,
                ::core::mem::size_of::<*mut libc::c_char>() as libc::c_ulong,
            ) as *mut *mut libc::c_char;
            *argv = xstrdup(b"new-session\0" as *const u8 as *const libc::c_char);
        }
        values = args_from_vector(argc, argv);
        pr = cmd_parse_from_arguments(
            values,
            argc as u_int,
            std::ptr::null_mut::<cmd_parse_input>(),
        );
        match (*pr).status as libc::c_uint {
            0 => {
                cause = (*pr).error;
            }
            1 | _ => {
                args_free_values(values, argc as u_int);
                free(values as *mut libc::c_void);
                cmd_free_argv(argc, argv);
                if (*c).flags & 0x800 as libc::c_int as libc::c_ulong != 0
                    && cmd_list_all_have((*pr).cmdlist, 0x2 as libc::c_int) == 0
                {
                    new_item = cmdq_get_callback1(
                        b"server_client_read_only\0" as *const u8 as *const libc::c_char,
                        Some(
                            server_client_read_only
                                as unsafe extern "C" fn(
                                    *mut cmdq_item,
                                    *mut libc::c_void,
                                )
                                    -> cmd_retval,
                        ),
                        std::ptr::null_mut::<libc::c_void>(),
                    );
                } else {
                    new_item = cmdq_get_command((*pr).cmdlist, std::ptr::null_mut::<cmdq_state>());
                }
                cmdq_append(c, new_item);
                cmdq_append(
                    c,
                    cmdq_get_callback1(
                        b"server_client_command_done\0" as *const u8 as *const libc::c_char,
                        Some(
                            server_client_command_done
                                as unsafe extern "C" fn(
                                    *mut cmdq_item,
                                    *mut libc::c_void,
                                )
                                    -> cmd_retval,
                        ),
                        std::ptr::null_mut::<libc::c_void>(),
                    ),
                );
                cmd_list_free((*pr).cmdlist);
                return;
            }
        }
    }
    cmd_free_argv(argc, argv);
    cmdq_append(c, cmdq_get_error(cause));
    free(cause as *mut libc::c_void);
    (*c).flags |= 0x4 as libc::c_int as libc::c_ulong;
}
unsafe extern "C" fn server_client_dispatch_identify(mut c: *mut client, mut imsg: *mut imsg) {
    let mut data: *const libc::c_char = std::ptr::null::<libc::c_char>();
    let mut home: *const libc::c_char = std::ptr::null::<libc::c_char>();
    let mut datalen: size_t = 0;
    let mut flags: libc::c_int = 0;
    let mut feat: libc::c_int = 0;
    let mut longflags: uint64_t = 0;
    let mut name: *mut libc::c_char = std::ptr::null_mut::<libc::c_char>();
    if (*c).flags & 0x40000 as libc::c_int as libc::c_ulong != 0 {
        fatalx(b"out-of-order identify message\0" as *const u8 as *const libc::c_char);
    }
    data = (*imsg).data as *const libc::c_char;
    datalen = ((*imsg).hdr.len as libc::c_ulong)
        .wrapping_sub(::core::mem::size_of::<imsg_hdr>() as libc::c_ulong);
    match (*imsg).hdr.type_0 {
        109 => {
            if datalen != ::core::mem::size_of::<libc::c_int>() as libc::c_ulong {
                fatalx(b"bad MSG_IDENTIFY_FEATURES size\0" as *const u8 as *const libc::c_char);
            }
            memcpy(
                &mut feat as *mut libc::c_int as *mut libc::c_void,
                data as *const libc::c_void,
                ::core::mem::size_of::<libc::c_int>() as libc::c_ulong,
            );
            (*c).term_features |= feat;
            log_debug(
                b"client %p IDENTIFY_FEATURES %s\0" as *const u8 as *const libc::c_char,
                c,
                tty_get_features(feat),
            );
        }
        100 => {
            if datalen != ::core::mem::size_of::<libc::c_int>() as libc::c_ulong {
                fatalx(b"bad MSG_IDENTIFY_FLAGS size\0" as *const u8 as *const libc::c_char);
            }
            memcpy(
                &mut flags as *mut libc::c_int as *mut libc::c_void,
                data as *const libc::c_void,
                ::core::mem::size_of::<libc::c_int>() as libc::c_ulong,
            );
            (*c).flags |= flags as libc::c_ulong;
            log_debug(
                b"client %p IDENTIFY_FLAGS %#x\0" as *const u8 as *const libc::c_char,
                c,
                flags,
            );
        }
        111 => {
            if datalen != ::core::mem::size_of::<uint64_t>() as libc::c_ulong {
                fatalx(b"bad MSG_IDENTIFY_LONGFLAGS size\0" as *const u8 as *const libc::c_char);
            }
            memcpy(
                &mut longflags as *mut uint64_t as *mut libc::c_void,
                data as *const libc::c_void,
                ::core::mem::size_of::<uint64_t>() as libc::c_ulong,
            );
            (*c).flags |= longflags;
            log_debug(
                b"client %p IDENTIFY_LONGFLAGS %#llx\0" as *const u8 as *const libc::c_char,
                c,
                longflags as libc::c_ulonglong,
            );
        }
        101 => {
            if datalen == 0 as libc::c_int as libc::c_ulong
                || *data.offset(datalen.wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize)
                    as libc::c_int
                    != '\0' as i32
            {
                fatalx(b"bad MSG_IDENTIFY_TERM string\0" as *const u8 as *const libc::c_char);
            }
            if *data as libc::c_int == '\0' as i32 {
                (*c).term_name = xstrdup(b"unknown\0" as *const u8 as *const libc::c_char);
            } else {
                (*c).term_name = xstrdup(data);
            }
            log_debug(
                b"client %p IDENTIFY_TERM %s\0" as *const u8 as *const libc::c_char,
                c,
                data,
            );
        }
        112 => {
            if datalen == 0 as libc::c_int as libc::c_ulong
                || *data.offset(datalen.wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize)
                    as libc::c_int
                    != '\0' as i32
            {
                fatalx(b"bad MSG_IDENTIFY_TERMINFO string\0" as *const u8 as *const libc::c_char);
            }
            (*c).term_caps = xreallocarray(
                (*c).term_caps as *mut libc::c_void,
                ((*c).term_ncaps).wrapping_add(1 as libc::c_int as libc::c_uint) as size_t,
                ::core::mem::size_of::<*mut libc::c_char>() as libc::c_ulong,
            ) as *mut *mut libc::c_char;
            let fresh0 = (*c).term_ncaps;
            (*c).term_ncaps = ((*c).term_ncaps).wrapping_add(1);
            let fresh1 = &mut (*((*c).term_caps).offset(fresh0 as isize));
            *fresh1 = xstrdup(data);
            log_debug(
                b"client %p IDENTIFY_TERMINFO %s\0" as *const u8 as *const libc::c_char,
                c,
                data,
            );
        }
        102 => {
            if datalen == 0 as libc::c_int as libc::c_ulong
                || *data.offset(datalen.wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize)
                    as libc::c_int
                    != '\0' as i32
            {
                fatalx(b"bad MSG_IDENTIFY_TTYNAME string\0" as *const u8 as *const libc::c_char);
            }
            (*c).ttyname = xstrdup(data);
            log_debug(
                b"client %p IDENTIFY_TTYNAME %s\0" as *const u8 as *const libc::c_char,
                c,
                data,
            );
        }
        108 => {
            if datalen == 0 as libc::c_int as libc::c_ulong
                || *data.offset(datalen.wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize)
                    as libc::c_int
                    != '\0' as i32
            {
                fatalx(b"bad MSG_IDENTIFY_CWD string\0" as *const u8 as *const libc::c_char);
            }
            if access(data, 1 as libc::c_int) == 0 as libc::c_int {
                (*c).cwd = xstrdup(data);
            } else {
                home = find_home();
                if !home.is_null() {
                    (*c).cwd = xstrdup(home);
                } else {
                    (*c).cwd = xstrdup(b"/\0" as *const u8 as *const libc::c_char);
                }
            }
            log_debug(
                b"client %p IDENTIFY_CWD %s\0" as *const u8 as *const libc::c_char,
                c,
                data,
            );
        }
        104 => {
            if datalen != 0 as libc::c_int as libc::c_ulong {
                fatalx(b"bad MSG_IDENTIFY_STDIN size\0" as *const u8 as *const libc::c_char);
            }
            (*c).fd = imsg_get_fd(imsg);
            log_debug(
                b"client %p IDENTIFY_STDIN %d\0" as *const u8 as *const libc::c_char,
                c,
                (*c).fd,
            );
        }
        110 => {
            if datalen != 0 as libc::c_int as libc::c_ulong {
                fatalx(b"bad MSG_IDENTIFY_STDOUT size\0" as *const u8 as *const libc::c_char);
            }
            (*c).out_fd = imsg_get_fd(imsg);
            log_debug(
                b"client %p IDENTIFY_STDOUT %d\0" as *const u8 as *const libc::c_char,
                c,
                (*c).out_fd,
            );
        }
        105 => {
            if datalen == 0 as libc::c_int as libc::c_ulong
                || *data.offset(datalen.wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize)
                    as libc::c_int
                    != '\0' as i32
            {
                fatalx(b"bad MSG_IDENTIFY_ENVIRON string\0" as *const u8 as *const libc::c_char);
            }
            if !(strchr(data, '=' as i32)).is_null() {
                environ_put((*c).environ, data, 0 as libc::c_int);
            }
            log_debug(
                b"client %p IDENTIFY_ENVIRON %s\0" as *const u8 as *const libc::c_char,
                c,
                data,
            );
        }
        107 => {
            if datalen != ::core::mem::size_of::<pid_t>() as libc::c_ulong {
                fatalx(b"bad MSG_IDENTIFY_CLIENTPID size\0" as *const u8 as *const libc::c_char);
            }
            memcpy(
                &mut (*c).pid as *mut pid_t as *mut libc::c_void,
                data as *const libc::c_void,
                ::core::mem::size_of::<pid_t>() as libc::c_ulong,
            );
            log_debug(
                b"client %p IDENTIFY_CLIENTPID %ld\0" as *const u8 as *const libc::c_char,
                c,
                (*c).pid as libc::c_long,
            );
        }
        _ => {}
    }
    if (*imsg).hdr.type_0 != MSG_IDENTIFY_DONE as libc::c_int as libc::c_uint {
        return;
    }
    (*c).flags |= 0x40000 as libc::c_int as libc::c_ulong;
    if *(*c).ttyname as libc::c_int != '\0' as i32 {
        name = xstrdup((*c).ttyname);
    } else {
        xasprintf(
            &mut name as *mut *mut libc::c_char,
            b"client-%ld\0" as *const u8 as *const libc::c_char,
            (*c).pid as libc::c_long,
        );
    }
    (*c).name = name;
    log_debug(
        b"client %p name is %s\0" as *const u8 as *const libc::c_char,
        c,
        (*c).name,
    );
    if (*c).flags & 0x2000 as libc::c_int as libc::c_ulong != 0 {
        control_start(c);
    } else if (*c).fd != -(1 as libc::c_int) {
        if tty_init(&mut (*c).tty, c) != 0 as libc::c_int {
            close((*c).fd);
            (*c).fd = -(1 as libc::c_int);
        } else {
            tty_resize(&mut (*c).tty);
            (*c).flags |= 0x1 as libc::c_int as libc::c_ulong;
        }
        close((*c).out_fd);
        (*c).out_fd = -(1 as libc::c_int);
    }
    if !(*c).flags & 0x4 as libc::c_int as libc::c_ulong != 0
        && cfg_finished == 0
        && c == clients.tqh_first
    {
        start_cfg();
    }
}
unsafe extern "C" fn server_client_dispatch_shell(mut c: *mut client) {
    let mut shell: *const libc::c_char = std::ptr::null::<libc::c_char>();
    shell = options_get_string(
        global_s_options,
        b"default-shell\0" as *const u8 as *const libc::c_char,
    );
    if checkshell(shell) == 0 {
        shell = b"/bin/sh\0" as *const u8 as *const libc::c_char;
    }
    proc_send(
        (*c).peer,
        MSG_SHELL,
        -(1 as libc::c_int),
        shell as *const libc::c_void,
        (strlen(shell)).wrapping_add(1 as libc::c_int as libc::c_ulong),
    );
    proc_kill_peer((*c).peer);
}
#[no_mangle]
pub unsafe extern "C" fn server_client_get_cwd(
    mut c: *mut client,
    mut s: *mut session,
) -> *const libc::c_char {
    let mut home: *const libc::c_char = std::ptr::null::<libc::c_char>();
    if cfg_finished == 0 && !cfg_client.is_null() {
        return (*cfg_client).cwd;
    }
    if !c.is_null() && ((*c).session).is_null() && !((*c).cwd).is_null() {
        return (*c).cwd;
    }
    if !s.is_null() && !((*s).cwd).is_null() {
        return (*s).cwd;
    }
    if !c.is_null()
        && {
            s = (*c).session;
            !s.is_null()
        }
        && !((*s).cwd).is_null()
    {
        return (*s).cwd;
    }
    home = find_home();
    if !home.is_null() {
        return home;
    }
    return b"/\0" as *const u8 as *const libc::c_char;
}
unsafe extern "C" fn server_client_control_flags(
    mut c: *mut client,
    mut next: *const libc::c_char,
) -> uint64_t {
    if strcmp(next, b"pause-after\0" as *const u8 as *const libc::c_char) == 0 as libc::c_int {
        (*c).pause_age = 0 as libc::c_int as u_int;
        return 0x100000000 as libc::c_ulonglong as uint64_t;
    }
    if sscanf(
        next,
        b"pause-after=%u\0" as *const u8 as *const libc::c_char,
        &mut (*c).pause_age as *mut u_int,
    ) == 1 as libc::c_int
    {
        (*c).pause_age = ((*c).pause_age as libc::c_uint)
            .wrapping_mul(1000 as libc::c_int as libc::c_uint) as u_int
            as u_int;
        return 0x100000000 as libc::c_ulonglong as uint64_t;
    }
    if strcmp(next, b"no-output\0" as *const u8 as *const libc::c_char) == 0 as libc::c_int {
        return 0x4000000 as libc::c_int as uint64_t;
    }
    if strcmp(next, b"wait-exit\0" as *const u8 as *const libc::c_char) == 0 as libc::c_int {
        return 0x200000000 as libc::c_ulonglong as uint64_t;
    }
    return 0 as libc::c_int as uint64_t;
}
#[no_mangle]
pub unsafe extern "C" fn server_client_set_flags(
    mut c: *mut client,
    mut flags: *const libc::c_char,
) {
    let mut s: *mut libc::c_char = std::ptr::null_mut::<libc::c_char>();
    let mut copy: *mut libc::c_char = std::ptr::null_mut::<libc::c_char>();
    let mut next: *mut libc::c_char = std::ptr::null_mut::<libc::c_char>();
    let mut flag: uint64_t = 0;
    let mut not: libc::c_int = 0;
    copy = xstrdup(flags);
    s = copy;
    loop {
        next = strsep(&mut s, b",\0" as *const u8 as *const libc::c_char);
        if next.is_null() {
            break;
        }
        not = (*next as libc::c_int == '!' as i32) as libc::c_int;
        if not != 0 {
            next = next.offset(1);
        }
        if (*c).flags & 0x2000 as libc::c_int as libc::c_ulong != 0 {
            flag = server_client_control_flags(c, next);
        } else {
            flag = 0 as libc::c_int as uint64_t;
        }
        if strcmp(next, b"read-only\0" as *const u8 as *const libc::c_char) == 0 as libc::c_int {
            flag = 0x800 as libc::c_int as uint64_t;
        } else if strcmp(next, b"ignore-size\0" as *const u8 as *const libc::c_char)
            == 0 as libc::c_int
        {
            flag = 0x20000 as libc::c_int as uint64_t;
        } else if strcmp(next, b"active-pane\0" as *const u8 as *const libc::c_char)
            == 0 as libc::c_int
        {
            flag = 0x80000000 as libc::c_ulonglong as uint64_t;
        } else if strcmp(
            next,
            b"no-detach-on-destroy\0" as *const u8 as *const libc::c_char,
        ) == 0 as libc::c_int
        {
            flag = 0x8000000000 as libc::c_ulonglong as uint64_t;
        }
        if flag == 0 as libc::c_int as libc::c_ulong {
            continue;
        }
        log_debug(
            b"client %s set flag %s\0" as *const u8 as *const libc::c_char,
            (*c).name,
            next,
        );
        if not != 0 {
            if (*c).flags & 0x800 as libc::c_int as libc::c_ulong != 0 {
                flag &= !(0x800 as libc::c_int) as libc::c_ulong;
            }
            (*c).flags &= !flag;
        } else {
            (*c).flags |= flag;
        }
        if flag == 0x4000000 as libc::c_int as libc::c_ulong {
            control_reset_offsets(c);
        }
    }
    free(copy as *mut libc::c_void);
    proc_send(
        (*c).peer,
        MSG_FLAGS,
        -(1 as libc::c_int),
        &mut (*c).flags as *mut uint64_t as *const libc::c_void,
        ::core::mem::size_of::<uint64_t>() as libc::c_ulong,
    );
}
#[no_mangle]
pub unsafe extern "C" fn server_client_get_flags(mut c: *mut client) -> *const libc::c_char {
    static mut s: [libc::c_char; 256] = [0; 256];
    let mut tmp: [libc::c_char; 32] = [0; 32];
    *s.as_mut_ptr() = '\0' as i32 as libc::c_char;
    if (*c).flags & 0x80 as libc::c_int as libc::c_ulong != 0 {
        strlcat(
            s.as_mut_ptr(),
            b"attached,\0" as *const u8 as *const libc::c_char,
            ::core::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong,
        );
    }
    if (*c).flags & 0x8000 as libc::c_int as libc::c_ulong != 0 {
        strlcat(
            s.as_mut_ptr(),
            b"focused,\0" as *const u8 as *const libc::c_char,
            ::core::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong,
        );
    }
    if (*c).flags & 0x2000 as libc::c_int as libc::c_ulong != 0 {
        strlcat(
            s.as_mut_ptr(),
            b"control-mode,\0" as *const u8 as *const libc::c_char,
            ::core::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong,
        );
    }
    if (*c).flags & 0x20000 as libc::c_int as libc::c_ulong != 0 {
        strlcat(
            s.as_mut_ptr(),
            b"ignore-size,\0" as *const u8 as *const libc::c_char,
            ::core::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong,
        );
    }
    if (*c).flags as libc::c_ulonglong & 0x8000000000 as libc::c_ulonglong != 0 {
        strlcat(
            s.as_mut_ptr(),
            b"no-detach-on-destroy,\0" as *const u8 as *const libc::c_char,
            ::core::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong,
        );
    }
    if (*c).flags & 0x4000000 as libc::c_int as libc::c_ulong != 0 {
        strlcat(
            s.as_mut_ptr(),
            b"no-output,\0" as *const u8 as *const libc::c_char,
            ::core::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong,
        );
    }
    if (*c).flags as libc::c_ulonglong & 0x200000000 as libc::c_ulonglong != 0 {
        strlcat(
            s.as_mut_ptr(),
            b"wait-exit,\0" as *const u8 as *const libc::c_char,
            ::core::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong,
        );
    }
    if (*c).flags as libc::c_ulonglong & 0x100000000 as libc::c_ulonglong != 0 {
        xsnprintf(
            tmp.as_mut_ptr(),
            ::core::mem::size_of::<[libc::c_char; 32]>() as libc::c_ulong,
            b"pause-after=%u,\0" as *const u8 as *const libc::c_char,
            ((*c).pause_age).wrapping_div(1000 as libc::c_int as libc::c_uint),
        );
        strlcat(
            s.as_mut_ptr(),
            tmp.as_mut_ptr(),
            ::core::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong,
        );
    }
    if (*c).flags & 0x800 as libc::c_int as libc::c_ulong != 0 {
        strlcat(
            s.as_mut_ptr(),
            b"read-only,\0" as *const u8 as *const libc::c_char,
            ::core::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong,
        );
    }
    if (*c).flags as libc::c_ulonglong & 0x80000000 as libc::c_ulonglong != 0 {
        strlcat(
            s.as_mut_ptr(),
            b"active-pane,\0" as *const u8 as *const libc::c_char,
            ::core::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong,
        );
    }
    if (*c).flags & 0x40 as libc::c_int as libc::c_ulong != 0 {
        strlcat(
            s.as_mut_ptr(),
            b"suspended,\0" as *const u8 as *const libc::c_char,
            ::core::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong,
        );
    }
    if (*c).flags & 0x10000 as libc::c_int as libc::c_ulong != 0 {
        strlcat(
            s.as_mut_ptr(),
            b"UTF-8,\0" as *const u8 as *const libc::c_char,
            ::core::mem::size_of::<[libc::c_char; 256]>() as libc::c_ulong,
        );
    }
    if *s.as_mut_ptr() as libc::c_int != '\0' as i32 {
        s[(strlen(s.as_mut_ptr())).wrapping_sub(1 as libc::c_int as libc::c_ulong) as usize] =
            '\0' as i32 as libc::c_char;
    }
    return s.as_mut_ptr();
}
#[no_mangle]
pub unsafe extern "C" fn server_client_get_client_window(
    mut c: *mut client,
    mut id: u_int,
) -> *mut client_window {
    let mut cw: client_window = {
        let mut init = client_window {
            window: id,
            pane: std::ptr::null_mut::<window_pane>(),
            sx: 0,
            sy: 0,
            entry: C2RustUnnamed_34 {
                rbe_left: std::ptr::null_mut::<client_window>(),
                rbe_right: std::ptr::null_mut::<client_window>(),
                rbe_parent: std::ptr::null_mut::<client_window>(),
                rbe_color: 0,
            },
        };
        init
    };
    return client_windows_RB_FIND(&mut (*c).windows, &mut cw);
}
#[no_mangle]
pub unsafe extern "C" fn server_client_add_client_window(
    mut c: *mut client,
    mut id: u_int,
) -> *mut client_window {
    let mut cw: *mut client_window = std::ptr::null_mut::<client_window>();
    cw = server_client_get_client_window(c, id);
    if cw.is_null() {
        cw = xcalloc(
            1 as libc::c_int as size_t,
            ::core::mem::size_of::<client_window>() as libc::c_ulong,
        ) as *mut client_window;
        (*cw).window = id;
        client_windows_RB_INSERT(&mut (*c).windows, cw);
    }
    return cw;
}
#[no_mangle]
pub unsafe extern "C" fn server_client_get_pane(mut c: *mut client) -> *mut window_pane {
    let mut s: *mut session = (*c).session;
    let mut cw: *mut client_window = std::ptr::null_mut::<client_window>();
    if s.is_null() {
        return std::ptr::null_mut::<window_pane>();
    }
    if !(*c).flags as libc::c_ulonglong & 0x80000000 as libc::c_ulonglong != 0 {
        return (*(*(*s).curw).window).active;
    }
    cw = server_client_get_client_window(c, (*(*(*s).curw).window).id);
    if cw.is_null() {
        return (*(*(*s).curw).window).active;
    }
    return (*cw).pane;
}
#[no_mangle]
pub unsafe extern "C" fn server_client_set_pane(mut c: *mut client, mut wp: *mut window_pane) {
    let mut s: *mut session = (*c).session;
    let mut cw: *mut client_window = std::ptr::null_mut::<client_window>();
    if s.is_null() {
        return;
    }
    cw = server_client_add_client_window(c, (*(*(*s).curw).window).id);
    (*cw).pane = wp;
    log_debug(
        b"%s pane now %%%u\0" as *const u8 as *const libc::c_char,
        (*c).name,
        (*wp).id,
    );
}
#[no_mangle]
pub unsafe extern "C" fn server_client_remove_pane(mut wp: *mut window_pane) {
    let mut c: *mut client = std::ptr::null_mut::<client>();
    let mut w: *mut window = (*wp).window;
    let mut cw: *mut client_window = std::ptr::null_mut::<client_window>();
    c = clients.tqh_first;
    while !c.is_null() {
        cw = server_client_get_client_window(c, (*w).id);
        if !cw.is_null() && (*cw).pane == wp {
            client_windows_RB_REMOVE(&mut (*c).windows, cw);
            free(cw as *mut libc::c_void);
        }
        c = (*c).entry.tqe_next;
    }
}
#[no_mangle]
pub unsafe extern "C" fn server_client_print(
    mut c: *mut client,
    mut parse: libc::c_int,
    mut evb: *mut evbuffer,
) {
    let mut data: *mut libc::c_void =
        evbuffer_pullup(evb, -(1 as libc::c_int) as ssize_t) as *mut libc::c_void;
    let mut size: size_t = evbuffer_get_length(evb);
    let mut wp: *mut window_pane = std::ptr::null_mut::<window_pane>();
    let mut wme: *mut window_mode_entry = std::ptr::null_mut::<window_mode_entry>();
    let mut sanitized: *mut libc::c_char = std::ptr::null_mut::<libc::c_char>();
    let mut msg: *mut libc::c_char = std::ptr::null_mut::<libc::c_char>();
    let mut line: *mut libc::c_char = std::ptr::null_mut::<libc::c_char>();
    if parse == 0 {
        utf8_stravisx(
            &mut msg,
            data as *const libc::c_char,
            size,
            0x1 as libc::c_int | 0x2 as libc::c_int | 0x40 as libc::c_int,
        );
        log_debug(
            b"%s: %s\0" as *const u8 as *const libc::c_char,
            (*::core::mem::transmute::<&[u8; 20], &[libc::c_char; 20]>(b"server_client_print\0"))
                .as_ptr(),
            msg,
        );
    } else {
        msg = evbuffer_pullup(evb, -(1 as libc::c_int) as ssize_t) as *mut libc::c_char;
        if *msg.offset(size.wrapping_sub(1 as libc::c_int as libc::c_ulong) as isize) as libc::c_int
            != '\0' as i32
        {
            evbuffer_add(
                evb,
                b"\0" as *const u8 as *const libc::c_char as *const libc::c_void,
                1 as libc::c_int as size_t,
            );
        }
    }
    if !c.is_null() {
        if ((*c).session).is_null() || (*c).flags & 0x2000 as libc::c_int as libc::c_ulong != 0 {
            if !(*c).flags & 0x10000 as libc::c_int as libc::c_ulong != 0 {
                sanitized = utf8_sanitize(msg);
                if (*c).flags & 0x2000 as libc::c_int as libc::c_ulong != 0 {
                    control_write(c, b"%s\0" as *const u8 as *const libc::c_char, sanitized);
                } else {
                    file_print(c, b"%s\n\0" as *const u8 as *const libc::c_char, sanitized);
                }
                free(sanitized as *mut libc::c_void);
            } else if (*c).flags & 0x2000 as libc::c_int as libc::c_ulong != 0 {
                control_write(c, b"%s\0" as *const u8 as *const libc::c_char, msg);
            } else {
                file_print(c, b"%s\n\0" as *const u8 as *const libc::c_char, msg);
            }
        } else {
            wp = server_client_get_pane(c);
            wme = (*wp).modes.tqh_first;
            if wme.is_null() || (*wme).mode != &window_view_mode as *const window_mode {
                window_pane_set_mode(
                    wp,
                    std::ptr::null_mut::<window_pane>(),
                    &window_view_mode,
                    std::ptr::null_mut::<cmd_find_state>(),
                    std::ptr::null_mut::<args>(),
                );
            }
            if parse != 0 {
                loop {
                    line = evbuffer_readln(evb, std::ptr::null_mut::<size_t>(), EVBUFFER_EOL_LF);
                    if !line.is_null() {
                        window_copy_add(
                            wp,
                            1 as libc::c_int,
                            b"%s\0" as *const u8 as *const libc::c_char,
                            line,
                        );
                        free(line as *mut libc::c_void);
                    }
                    if line.is_null() {
                        break;
                    }
                }
                size = evbuffer_get_length(evb);
                if size != 0 as libc::c_int as libc::c_ulong {
                    line =
                        evbuffer_pullup(evb, -(1 as libc::c_int) as ssize_t) as *mut libc::c_char;
                    window_copy_add(
                        wp,
                        1 as libc::c_int,
                        b"%.*s\0" as *const u8 as *const libc::c_char,
                        size as libc::c_int,
                        line,
                    );
                }
            } else {
                window_copy_add(
                    wp,
                    0 as libc::c_int,
                    b"%s\0" as *const u8 as *const libc::c_char,
                    msg,
                );
            }
        }
    }
    if parse == 0 {
        free(msg as *mut libc::c_void);
    }
}
